Caps Lock - From Shouting to Superpower

Caps Lock - From Shouting to Superpower
Date
Tags
Linux
MacOS
Utilities

Rethinking the functionality of a forgotten key could lead to a powerful new tool.

Nestled between the stalwart Shift and the ever-faithful Tab, there exists a key shrouded in mystery: Caps Lock. Once a champion of SHOUTING MESSAGES, its glory days seem to have faded into the era of emoticons and bold text.

But what if this underutilized giant could be awakened? What if its prime location could be harnessed for a purpose more dynamic, more versatile? This story explores the untapped potential of Caps Lock, a key poised for a glorious comeback. We’ll delve into how a simple remap can unlock a world of efficiency, transforming it from a relic of the past into a powerful tool for the modern typist.

Linux

Starting of with Linux, we can configure caps lock using xremap (works with both the X11 and Wayland environment).

Provided below is the configuration I currently use. Tapping the caps lock key makes it the escape button. This is very useful for us vim lowers. Holding it down and it acts like a modifier for easier access to keys like Home, End, Back space, Delete and all the arrow keys.

Grab the latest release and save it to a convenient location, for example: /home/user/bin/xremap

Create a new file named xremap-config.yml (or a similar) in your configuration directory /home/user/.config/xremap-config.yml:

virtual_modifiers:
  - CapsLock
keymap:
  - remap:
      CapsLock-h: Left
      CapsLock-j: Down
      CapsLock-k: Up
      CapsLock-l: Right
      CapsLock-d: Delete
      CapsLock-f: BackSpace
      CapsLock-i: Home
      CapsLock-o: End
modmap:
  - remap:
      KEY_CAPSLOCK:
        held: KEY_CAPSLOCK
        alone: KEY_ESC

To be able to start xremap when we boot up, create a systemd service with the following contents and save it to: /etc/systemd/user/xremap.service.

[Unit]
Description=Start xremap

[Service]
Type=simple
ExecStart=/home/user/bin/xremap /home/user/.config/xremap-config.yml --watch

[Install]
WantedBy=default.target

Notice the --watch flag, this makes xremap watch for newly connected devices and apply the configuration to them as well.

Then we need to run the following commands to enable it:

systemctl --user daemon-reload - Reload so systemctl can find our new service.

systemctl --user start xremap.service - Start the service.

systemctl --user enable xremap.service - Make the service start on boot.

MacOS

In MacOS we can achive the same functionaliy using an application called Karabiner and loading the script provided by https://github.com/Vonng/Capslock. Follow the installation steps to get started.

More Articles