2

I'm trying to create a new input method using Input Method Kit. The documentation is very lacking, but I believe I'm setting the project up correctly and I place the input method into ~/Library/Input Methods after building it. However, I see strange behavior when looking at the list of input sources in Language & Text preferences.

The NumberInput sample seems to work fine for me, and there are no differences in my new input method that I can find, aside from the values for tsInputMethodIconFileKey, InputMethodConnectionName, InputMethodServerControllerClass, and CFBundleIdentifier in Info.plist. But I'm seeing these issues:

  • When I use my desired bundle identifier for the app, nothing shows up in the list. (This bundle ID doesn't exist anywhere else on my system.)
  • Changing the bundle identifier to be the same as the NumberInput sample makes it show up in the list, but when I select it, it sometimes duplicates entries in the list, and generally behaves weirdly.
  • As I make slight modifications to the bundle identifier, it seems to behave normally, but once I change it back to the original identifier (the desired one) it disappears from the list.
  • If I quit the process associated with my input method, selecting it in the menu again doesn't relaunch it.

Does anyone have any idea what's going on? Apple's documentation for IMKit is nearly nonexistant and it doesn't seem like many people have documented their own attempts at making input methods. Is there something I'm missing?

Thanks in advance!

P.S. Yes I've tried logging out and back in and even restarting my computer, nothing seems to significantly change the behavior I mentioned above.

pkamb
  • 33,281
  • 23
  • 160
  • 191
jtbandes
  • 115,675
  • 35
  • 233
  • 266

2 Answers2

4

This worked for me. Try this: make sure your bundle identifier contains "inputmethod" somewhere in the path. Example "com.blugs.inputmethod.IPAPalette". Yes AFAIK it's totally undocumented. Yes the documentation is awful. Hope this helps! Cheers.

K8TIY
  • 74
  • 2
  • It seems like this really is the solution. Sad that it's something so simple yet undocumented. Thanks! – jtbandes Apr 15 '12 at 15:25
  • Thanks. The documentation totally does not say anything. I wasted an afternoon to find out the problem but in the evening I found your answer :( – Stackia Oct 18 '14 at 10:14
  • It seems to also want `inputmethod` within the first 3 tokens of the bundle identifier. Specifically `com.myCompany.theInputName.inputmethod` does not work for me, but `com.myCompany.inputmethod.theInputName` does. So don't just add `.inputmethod` to the *end* of the name of your existing bundle identifier. – pkamb Jun 14 '15 at 19:16
2

The accepted answer here is very useful, adding .inputmethod. to your Bundle ID.

I'll add that I found a bit of documentation for this in TextInputSources.h, which contains a large number of comments and documentation not found in the Input Method Kit overview docs. Worth a read.

Carbon > Frameworks > HIToolbox > TextInputSources.h

In the Info.plist file, the value for the CFBundleIdentifier key must be a string that includes ".keyboardlayout."; typically this might be something like "com.companyname.keyboardlayout.MyKeyboardLayouts" (Before Leopard, it was required to be a string that began "com.apple.keyboardlayout", even for keyboard layouts not supplied by Apple).

and

If this key is not specified, an InputSourceID will be constructed by combining the BundleID with an InputModeID suffix formed by deleting any prefix that matches the BundleID or that ends in ".inputmethod."

pkamb
  • 33,281
  • 23
  • 160
  • 191
  • Good find! I would recommend filing a Radar letting them know that this documentation only exists in Carbon headers. Clearly it should be moved/copied elsewhere! – jtbandes Dec 11 '15 at 23:11