MacOS – How to add characters to the press and hold character picker in OS X Lion

internationalizationkeyboardmacos

In OS X Lion, there is a very useful feature for people like me who need to write in multiple languages, which pops up a small menu of additional characters when you hold down a letter.

For instance, when I hold down the letter E, I get:

e

This is great when I'm writing in French for example. However right now I need to write something in Czech; however, the Czech letter ě (looks like the 3rd letter in the popup with the accent flipped) does not appear in the popup.

Is there a way to tell OS X to include Czech or other additional characters in those popups?

Note: I do not want to use the Czech keyboard layout; I found switching layouts for each language is somewhat unpractical.

Best Answer

The characters included in the popovers are defined in property lists inside the /System/Library/Input\ Methods/PressAndHold.app/ bundle.

I was able to change à to y by editing /System/Library/Input\ Methods/PressAndHold.app/Contents/Resources/Keyboard-en.plist and logging out and back in.

(note the escape in "Input Method" if you're copy pasting)

<key>Roman-Accent-a</key>
<dict>
    <key>Direction</key>
    <string>right</string>
    <key>Keycaps</key>
    <string>a y á â ä æ ã å ā</string>
    <key>Strings</key>
    <string>a y á â ä æ ã å ā</string>
</dict>