![](https://alex.brovk.in/content/images/2024/06/keyboard-1.gif)
The caps lock key is probably the most useless button on your keyboard, and arguably the Internet would be a better place without it.
I originally wrote an article on Medium to do this on Mac OS, but I have recently switched to Linux and really missed the functionality.
A great way to use the caps lock key is to turn it into what some call the "hyper key" which is mapping the one caps lock key to a combination of Ctrl+Alt+Super+Shift
(where Super is Meta/Cmd/Win)... not to be confused with the actual "Hyper" key if you're using a space-cadet keyboard.
The great thing about this "hyper" key is it allows you to associate new key shortcuts that are unlikely to conflict with other apps. For example, I use HYPER+e to launch VSCode, HYPER+c for my browser, HYPER+t for Terminal, HYPER+arrow keys to move windows between monitors, and so on.
The Linux problem
Mac OS was nice and simple, but for Linux I could not find an easy solution. There are a few ways to do it with X11, but I didn't want to move away from Wayland, so I used KMonad, which seems like one of the few options.
The process of getting it setup isn't complicated, but it's exactly quick, and you need to know your way around bash profiles or setting up services. These instructions will be based on Ubuntu 24.04 + Wayland GNOME, but should work across distros and desktops.
(1) First you need to install KMonad. The installation instructions are pretty good, but might involve installing stack Haskell project manager (lol), and you might need to add a $PATH
, and you need to set the permission correctly (see the FAQ for instructions on these) – don't skip this.
(2) Second, create your configuration file. There's an insanely long tutorial for it, but the TL:DR; is that you need to create an alias (defalias sym C-A-M-sft)
and put @sym
where the caps lock button is on your layer. You can grab my full configuration file on GitHub, but take note that I also swap my Super and Alt keys to match my Apple keyboard, and I also use a script to load all my keyboards (see below).
(3) I used a script to load all my keyboard (usb and internal keyboard). You could have done this in a number of ways, but I like this approach because I want all my keyboard to have the same layout and functionality. Don't forget to chmod +x ...
this file, and adjust the path to your .kbd
config accordingly.
#!/bin/bash
# script to load all kbd file with KMonad
# don't forget to `chmod +x ...` this file
find /dev/input/by-path/*kbd* | while read -r KBD_DEV; do
{
echo "$KBD_DEV"
export KBD_DEV
KBDCFG=$(envsubst < /home/ab/.config/kmonad/config-all.kbd)
echo "$KBDCFG"
kmonad <(echo "$KBDCFG") }
done
https://github.com/brovalex/public-experiments/blob/main/hyper-key-linux/kmonad_all.sh
(4) Finally, you need a way load your configuration file. You could have run kmonad
with your configuration file, but you'd need to do that every time you turn on your computer. You can start KMonad automatically in a number of ways (e.g. adding the command in Settings > Startup applications), but you also add the GNOME Extension KMonad Toggle. Note that I'm specifying my custom script at the bottom, and I've added an &
so that the cursor doesn't get stuck on "in progress".
![](https://alex.brovk.in/content/images/2024/06/image-5.png)
(5) Now for the fun part - you should be able to shortcuts using the caps lock key. When you press it, you should see it show as Ctrl+Alt+Super+Shift
🎉 !!