Bodhi Linux logo

Swapping ESC and Caps Lock on Bodhi LinuxΒΆ

When former student Marco Sirabella told me last year that back when Bill Joy first created the vi text editor in 1976, the ESC key was located where the Caps Lock key presently is, a light went off in my head. I had long wondered why the otherwise motion efficient editor had such a glaring flaw, making its users stretch their left pinky fingers so far and so often. I became immediately obsessed with finding the best ways to swap the ESC and Caps Lock keys on all my computers. For most of the Linux distributions I use in my classroom (including Ubuntu, Xubuntu, Scientific Linux, and Fedora, this process is fairly trivial, since the GUI desktop configuration tools support making the swap.

For my newest distro, Bodhi Linux, however, I searched in vain for any distro specific documentation on how to do this. I did find a solution, which I posted on the r/bodhlinux subreddit, asking if there was a more “Bodhi way” than the way I will describe below, but thus far no one has responded with one.

So, here is what I did:

  1. Create the file .speedswapper in my home directory with the following contents:

    ! Swap caps lock and escape
    remove Lock = Caps_Lock
    keysym Escape = Caps_Lock
    keysym Caps_Lock = Escape
    add Lock = Caps_Lock
    
  2. Edit my .bashrc file to contain the following:

    # Run script to swap ESC and Caps Lock keys
    xmodmap ~/.speedswapper
    

That’s all there is to it. Either source the .bashrc file or log out and log back in, and the ESC and Caps Lock keys are swapped.