Lars Wiegman

  • Home
  • Skills
  • Contact
  • Blog

Do more with the Caps lock key in OS X

posted on March 17, 2014 #

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

  1. Launch the System Preferences app
  2. Navigate to the Keyboard panel, from the Keyboard tab click the “Modifier Keys…” button
  3. 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.

  1. Download and install PCKeyboardHack matching your OS X version

  2. 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.

  3. Launch the PCKeyboardHack app

  4. Change the keycode of the Caps Lock key to a key you don't regularly use, like F19 which has keycode 80.

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 ~/.tmux.conf:

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.

Read Next:

Random password generator

I was updating a random password generator for a project, thought I'd share the resulting code. Also availabe as a gist. Using a default length of 14 characters this should generate passwords with 84 bits of entropy. #!/usr/bin/env python # -*- coding: utf-8 -*- import os, string def random_password(length=14): """ Random password generator. Default generated password will have an entropy of 84 bits. For each character in the password, generate a random byte, reduce the integer value to modulo 64 and use the result as an index on the character pool. Continue »

  • Home
  • Skills
  • Blog
  • Contact
  • •
  • Archive
  • Feed
  • GitHub

Copyright © 2007-2024 Lars Wiegman