parallax
Jason Martin

Tech Evangelist & Software Engineer

My #1 most valuable productivity hack, hands-down!
Tools
Productivity
Software

Why would you want to transform your Caps Lock into another key, such as your Esc or Ctrl / Cmd key? To transform your most useless key into your most useful one, that’s why! Caps Lock a terrible default option, and only continues to exist in keyboards because people are used to the layout.

When is the last time you’ve needed to use your Caps Lock key? Let’s be honest, the Caps Lock is really only useful if you’re an internet grandpa who likes to yell at kids to keep off Twitch! The fact that the Caps Lock key is not only one of of the biggest on the keyboard, but also resides in a prime location on the home row makes enabling this little hack a no-brainer for huge productivity gains (not to mention the reduction in typing-releated strains/injuries).

While there are plenty of options that you can remap Caps Lock to, this article is specificially about converting your Caps LockEscape (when pressed alone), or Ctrl (when pressed with another key). This allows you to use the same key to solve the most common (and un-ergonomic) problems — both the Esc and Ctrl key are very hard to reach with the pinky finger - and it makes working with software like VIM so much better!

ℹ️ Bonus feature: Caps2Esc also remaps the Esc key to act as the Caps Lock, helpful for those few times when I could actually use the Caps functionality (you know, for those young whippersnappers on my Twitch)

This productivity tweak can be easily set up on Windows_,_ Mac_, or_ Linux

  • Linux: I highly suggest using Caps2Esc (which the install guide below is focused on)
    • This tool is much better for remapping Caps Lock than alternatives such as Xmodmap and xcape, because it is built upon the interception library. This means that it handles the key mappings at a much lower level, and is available on the bare terminal (Ctrl+Alt+F2) instead of depending on the X server like other solutions. This means Caps2Esc works in both Wayland and X with zero reconfiguration.
  • Mac OS: has multiple solutions, including the popular Karabiner-Elements tool
    • Remapping the Caps Lock is even more important on all of the new Macbooks (2016+) with the Touch Bar. Using this solution now you can actually have an Esc key that works!!!
  • Windows: has the awesome open source dual-key-remap tool
    • Like Caps2Esc this tool also works at a low level, and based on personal experience is a much better solution for remapping Caps LockCtrl/Esc than AutoHotkey.

Getting up and running in Arch/Manjaro is as easy as 1-2-3!

  1. Install using AUR tool of choice (using yay in this example): yay -S interception-caps2esc

  2. Paste the contents of the below script into your terminal to configure the Caps2Esc service:

    #!/bin/bash
    # Post install config solution found at: https://askubuntu.com/questions/979359/how-do-i-install-caps2esc
    
    echo "Make sure you run this script as root!"
    
    # Configure udevmon.yaml
    echo "- JOB: \"intercept -g \$DEVNODE | caps2esc | uinput -d \$DEVNODE\"
      DEVICE:
        EVENTS:
          EV_KEY: [KEY_CAPSLOCK, KEY_ESC]
    " >> /etc/udevmon.yaml
    
    # Configure udevmon.service
    echo "[Unit]
    Description=udevmon
    Wants=systemd-udev-settle.service
    After=systemd-udev-settle.service
    
    [Service]
    ExecStart=/usr/bin/nice -n -20 /usr/bin/udevmon -c /etc/udevmon.yaml
    
    [Install]
    WantedBy=multi-user.target
    " >> /etc/systemd/system/udevmon.service
    

    ^ This script appends to the end of your udevmon.yaml and udevmon.service files if they already exist. If you would like to play it safe, make a backup of these files first.

    Also, make sure to run the script as root!

  3. Start udevmon to start running the Caps2Esc service

    # Enable udevmon
    systemctl enable --now udevmon
    

And that’s it! If everything went as it should, your Caps Lock key should now act as the Esc key when pressed on it’s own, and Ctrl when pressed in combination with another key (i.e. Caps Lock + C should copy highlighted text to the clipboard, Caps Lock + V will paste the contents, etc).

Enjoy the power of your new magic key…your pinky finger will thank you!