I am using a custom keyboard layout, created by Ukelele. It was serving me well for years, until I started to use it on a MacBook Pro with Touch Bar. I added the "Change Input Language" button to the Touch Bar's Control Strip and whenever I press it, the language is switched. It worked fine for weeks, but suddenly it is just not switching from the Touch Bar. But it does switch from the top menu bar and keyboard.
Now some technical details. I've tried to use both a .keylayout file as well as bundle file. I've tried to install it both in
/Library/... and in
~/Library/.... When the problem appears, it's not easy to recover it, even with reboots. Removing/adding my custom layout again doesn't work most of the time. The Touch Bar does switch using built-in languages.
I've contacted the developer of Ukelele, but he couldn't test it due to not having a MacBook Pro with Touch Bar and had no clue.
So I looked into logs and found a Touch Bar crash:
Jul 23 21:45:17 xxxx com.apple.DFRSystemExtra.InputMenu: objc: Class TIMLog is implemented in both /System/Library/CoreServices/Menu Extras/TextInput.menu/Contents/SharedFrameworks/TextInputUI.framework/Versions/A/TextInputUI (0x102c88858) and /System/Library/CoreServices/ControlStrip.app/Contents/XPCServices/com.apple.DFRSystemExtra.InputMenu.xpc/Contents/MacOS/com.apple.DFRSystemExtra.InputMenu (0x102c64958). One of the two will be used. Which one is undefined. Jul 23 21:45:18 xxxx com.apple.xpc.launchd (com.apple.DFRSystemExtra.InputMenu): Service exited due to signal: Segmentation fault: 11 sent by exc handler
I noticed one difference - built in languages show a 2 letter language name on the Touch Bar button, while my custom layout shows an icon. I haven't found a way in Ukelele to make my custom layout show a 2 letter language abbreviation—maybe someone can suggest a way that I can try. So my guess is that it happens due to the custom layout icon, but it was copied from a built-in layout.