My post “A useful Caps Lock key”—based on a method pointed out by Steve Losh—has been one of the most popular pages on this blog over time (up there with nvALT and iTextEditors). It turns your Caps Lock key into a “Hyper” key that emulates holding Control, Option, Shift, and Command all at once, which is handy for expanding your keyboard shortcut collection.
In that post, the resulting key would function as the Hyper-modifier when held, and as Escape when tapped. I wanted to point out that the tap-only keystroke can be modified easily, and that you can also use it to maintain Caps Lock functionality.
As detailed in the original post, this still uses Seil and Karabiner. You still want to disable Caps Lock in System Preferences->Keyboard->Modifier Keys… (and note that this has to be done for all keyboards, internal and external), and then open the
private.xml file (in Karabiner, go to Misc & Uninstall and click “Open private.xml”).
The code below demonstrates how to have Caps Lock toggle only when the key is tapped, while behaving as a Hyper key when held and combined with another keystroke.
<item> <name>F19 to F19</name> <appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, send CAPSLOCK)</appendix> <identifier>private.f192f19_capslock</identifier> <autogen> --KeyOverlaidModifier-- KeyCode::F19, KeyCode::COMMAND_L, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L, KeyCode::VK_LOCK_CAPSLOCK </autogen> </item>
That code can go anywhere inside the
<root> tag of the
private.xml file, and you’ll want to replace the Hyper/Escape code if you’re already using it.
private.xml file provides a plethora of possibilities, so if you’re looking to get crazy with it, check out the docs!