MacOS – How to define Lion’s key variations in a `.keylayout` file

keyboardmacos

In Lion you can hold down a key to show its variations.

Screenshot

However, when using my custom keyboard layout in .keylayout format, this functionality is disabled.

I assume Lion’s default keyboard layouts have the special characters that appear when you hold down a certain key hardcoded somewhere, and my old custom keyboard layout (based on the default Snow Leopard-layouts) lacks that data.

My question is: how can these “key variations” be defined in a .keylayout file?

Best Answer

The special characters included in the popovers are defined in files like /System/Library/Input Methods/PressAndHold.app/Contents/Resources/Keyboard-en_US.plist, not in .keylayout files. (The popovers are also used with languages that have their own input methods like Vietnamese.)

I don't know how to add a property list like that for a custom layout though. I also tried copying the U.S..keylayout that comes with Ukelele to ~/Libary/Keyboard Layouts/ (without changing the name or id), but the popovers didn't work with it.