To most of us, the
Caps Lock key is useless and even annoying; waiting to be accidentally turned on and litter your input with caps. Which is a pity because considering its location and size it’s a convenient key to tap.
By disabling the Caps lock functionality in OS X and using a third party app, the Caps lock key can become quite useful.
For example, control tmux, on OS X version 10.9.
Disable the Caps lock key in OS X
- Launch the System Preferences app
- Navigate to the Keyboard panel, from the Keyboard tab click the “Modifier Keys…” button
- Choose the “No Action” option for the Caps Lock Key
Tapping the Caps lock key will now be ignored by OS X.
Remap the Caps lock key
Because the Caps lock key isn’t a regular key, it can’t be configured by applications or OS X, we’ll need to remap it to a regular key, preferably one you rarely use, like
F19. PCKeyboardHack allows us to do just that.
- Download and install PCKeyboardHack matching your OS X version
After installing PCKeyboardHack you’ll need to restart OS X or load the kext manually:
$ sudo kextload /Applications/PCKeyboardHack.app/Contents/Library/PCKeyboardHack.10.9.signed.kext
Note! Load the kext matching your OS X version.
Launch the PCKeyboardHack app
Change the keycode of the Caps Lock key to a key you don’t regularly use, like
F19which has keycode
Tapping the Caps lock key will now invoke the F19 keycode.
Configure tmux to use Caps lock
To use the remapped Caps lock key as a prefix for tmux, you’ll need to bind the F19.
Add the following to your
unbind C-b set-option -g prefix F19
If tmux was already running, reload its configuration file:
$ tmux source-file ~/.tmux.conf
Tapping Caps lock will be less of a strain on your finger than tapping Ctrl-b.