Input source keeps resetting itself after re-login

It started about a week ago.

I usually have 2 input sources, namely Canadian English and Chinese.

But now, every time I log out and log back in again, the input source will become US English.

Can anyone help me with that?

MacBook Pro, OS X Mountain Lion (10.8.1)

Posted on Nov 27, 2012 2:13 PM

Reply
10 replies

Nov 28, 2012 8:15 AM in response to lisq199

I have this problem too, occurs despite any combination of the following factors:


- leaving US as a secondary input source

- removing US as a chosen input source

- having only one input source

- choosing use as same one in all documents

- allow for a different one for each document

- the keyboard shortcuts are disabled

- input menu is shown or hidden on the menu bar

Nov 29, 2012 9:16 AM in response to nodst3r

In an effort to create a workaround:


I created a version of this to select a given input. The original version only selected enabled inputs, whereas my version will run enable the input (if necessary) and switch to it.


This allows us to create an apple script and save it as an application which can then be run on login:


set executablePath to quoted form of "/Applications/changeInputSource"

set inputSourceID to "com.apple.keylayout.British"

do shell scriptexecutablePath&" "&inputSourceID


Note: in our particular case this will leave US English as an input and show the input menu in menu bar if this is selected.


You can download a compiled version with source code and the example applescript here.


Note: The apple script assumes you will place the compiled application "changeInputSource" into /Applications/



You can refer to the original message on how to compile the source, assuming you create the file on the Desktop I used an additional parameter with my version of the XCode compiler highlighted in bold:


cd ~/Desktop; gcc "changeInputSource.m" -o "changeInputSource" -l objc -framework foundation -framework carbon -std=c99

#import <Foundation/Foundation.h>

#import <Carbon/Carbon.h>



BOOL changeInputSourceTo(NSString *inputID, BOOL checkAllInstalledInputs) {

BOOL b = NO;

NSMutableString *thisID;

TISInputSourceRef inputSource = NULL;

CFArrayRef availableInputs = TISCreateInputSourceList(NULL, checkAllInstalledInputs);

NSUInteger count = CFArrayGetCount(availableInputs);

for (int i = 0; i < count; i++) {

inputSource = (TISInputSourceRef)CFArrayGetValueAtIndex(availableInputs, i);

CFStringRef type = TISGetInputSourceProperty(inputSource, kTISPropertyInputSourceCategory);

if (!CFStringCompare(type, kTISCategoryKeyboardInputSource, 0)) {

thisID = TISGetInputSourceProperty(inputSource, kTISPropertyInputSourceID);

if (b) {

printf("%s\n", [thisID UTF8String]);

} else if ([thisID isEqualToString:inputID]) {

b = YES;

OSStatus err = TISEnableInputSource(inputSource);

if (err) {

printf("Error %i\n", (int)err);

}

err = TISSelectInputSource(inputSource);

if (err) printf("Error %i\n", (int)err);

break;

}

}

}

CFRelease(availableInputs);

return b;

}



int main (int argc, const char *argv[]) {

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSString *inputID;

if (argc >= 2){

inputID = [NSString stringWithUTF8String:argv[1]];

if(!changeInputSourceTo(inputID,NO)) {

if(!changeInputSourceTo(inputID,YES)){

printf("not available\n");

}

}

}

[pool release];

return 0;

}

Nov 29, 2012 9:22 AM in response to lisq199

For your particular use case:

lisq199 wrote:

I usually have 2 input sources, namely Canadian English and Chinese.

You might use:

set executablePath to quoted form of "/Applications/changeInputSource"

do shell script executablePath & " " & "com.apple.inputmethod.TCIM"

do shell script executablePath & " " & "com.apple.inputmethod.SCIM"

do shell script executablePath & " " & "com.apple.keylayout.Canadian"


You can manually set the languages you wish to use and examine com.apple.HIToolbox.[UID].plist from ~/Library/Preferences/ByHost/ to determine your requred input source.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Input source keeps resetting itself after re-login

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.