Thanks to Unicode, emoji and the rich range of symbols used today, our keyboards can only enter a small fraction of the characters we use. While some apps like Messages provide convenient tools which prompt conversions from text like 🙂 to popular emojis, and there’s always Emoji & Symbols, sometimes we want more convenient keyboard access to custom characters. This article looks at two very different ways of achieving that, using an Input Source, or a whole Keyboard Layout.
The difference between these is substantial. Custom keyboard layouts are great when you want to use special characters a lot, and want to remap many of your keys. Some time ago, Fred Benenson edited a translation of Herman Melville’s novel Moby Dick into emoji. If that’s the sort of thing you want to write from your keyboard, then a complete keyboard layout is the only way to go.
Apple now provides a gamut of language-specific keyboards which should cater for all but the most specialist user. If you can’t find one listed among those which are offered by clicking the + button in the Input Sources tab of the Keyboard pane, then look at SIL’s resources, such as those offered by Keyman. Although you can also use the macOS Keyman app to customise your own, I recommend that you use Ukelele instead, as I explain below.
Far more common than wanting a whole custom keyboard, many of us would like a simpler means of accessing the occasional special character. One way to do this in macOS is using an Input Method, which Apple explains here. I provide the text of my example Input Plugin in the Appendix; its character substitutions are:
Input Methods don’t normally map ordinary keys to special characters in the way that a Keyboard Layout does, but provide you with a keyboard-based method for adding characters you’ve set up in the Input Plugin. In most languages, you don’t normally use an Input Plugin at all. Each key that you type is converted to its Unicode representation and inserted into the text you’re editing. An Input Method provides you with a slightly different situation: type a word in, press Return, and the Input Method checks whether to perform a substitution for those characters. If it does, it inserts the substitute before you can type a space and the next word.
You define the substitutions in an Input Plugin, which is a text file, and that’s stored in the Input Methods folder, either in your Home folder library ~/Library or the same in the main Library folder (for access by all users of that Mac). Once installed, the Input Method is listed in the Keyboard menu, and more importantly you can switch to it by pressing Control-Space.
When you’ve written your .inputplugin file, saving it in UTF-16 plain text format, double-click it in the Finder and it will be copied into ~/Library/Input Methods and appear in the Keyboard menu.
To use this when writing, when you want to make one of your substitutions, press Control-Space until the Input Plugin is selected as the keyboard, type the word for the custom character, press Return to convert it, then press Control-Space again to return to your normal keyboard layout. This is the same basic process as you might use for standard Roman-based input methods for non-Roman languages like Chinese.
These go right back to the early days of Classic Mac OS, when they were defined in special Keyboard resources. They’re now stored in Keyboard Layouts folders in either your Home library folder ~/Library, or the main library. Although they’re also text-based, they’re a lot more tedious to write by hand. Even if you only want to build a basic custom keyboard layout, you’ll be better off using a tool like Ukelele, available free from SIL.
Ukelele is a mature and powerful app which you can use to create almost anything you want by way of a custom keyboard. It also makes simpler tasks easy: features like its New from Current Input Source command, which creates a complete keyboard from the layout you’re currently using. You can then just drag and drop Unicode characters from the floating Emoji & Symbols window onto the keys to build your layout. Ukelele can install the complete layout for you, although you still need to log out and back in before you can start using it.
Once you have installed your custom keyboard layout, you might be puzzled as to why it doesn’t appear in the main list of those available in the Keyboard pane. Scroll to the end of that list and select the last item Others. You should then see your custom layout listed at the upper right, and can add it using the button.
Appendix: Example Input Plugin