Last month, I came across an article discussing the Cocoa text system, which is intended as a user-level guide for understanding and customizing the text input system used in many Mac OS X applications. One of the tricks it suggests is setting up key bindings to allow easy entry of Greek letters.
This idea appealed to me, as I’ve been using many Greek letters in my computer science notes, but much of my software doesn’t use the Cocoa text system, so that bit of advice didn’t do much for me.
Fortunately, the page links to Ukelele, a program that helps edit keyboard layouts. Keyboard layouts aren’t quite as flexible as key bindings, but they apply to all applications.
Using Ukelele, I remapped Option-P (normally bound to “π”) to a “dead key”. Dead keys are used in Macintosh keyboard layouts to temporarily switch modes. For example, typing Option-U A results in “ä”, Option-I A results in “â”, and so forth. My new Option-P dead key temporarily puts the keyboard in Greek mode, so that Option-P A results in “α”, Option-P Shift-S results in “Σ”, and so forth.
Previously, typing individual Greek letters required either switching the keyboard layout to Greek or bringing up the character palette and selecting the characters individually. Now, I can type πλανητες straight from the keyboard.
Eventually, I’ll add arrows and the multiplication sign (×), so I can write things like “π1 : α × β → α” conveniently.
Before I do that, I’ll probably switch from customizing the standard U.S. layout to customizing the U.S. Extended layout, which features pretty much every Roman character you could want, including Eastern European diacritics, obsolete letters, and the International Phonetic Alphabet. Because you never know when you might need a “ȝ” (yogh).