Improving keyboard ergonomics through dual use keymapping

burnskp

Kevin Burns

Posted on July 23, 2024

Improving keyboard ergonomics through dual use keymapping

If you’ve followed the online Apple Community then you’ve probably heard of the hyper key. If not, the hyper key is where you map caps lock so that if you hold it down it acts as if you’re holding down ctrl+option+cmd+shift, giving you another “modifier” key. Some people go further by configuring it to act as hyper when held and used with another key and act as escape when you tap it.

I’ve seen a similar use case in the Linux VIM community where you use xcape to map caps lock as ctrl if held and used as a modifier and escape if tapped. I find this very useful and I have a hard time using a computer when it’s not setup this way.

Unfortunately, xcape only works for X11. When I moved to sway I had to find another solution. I’ve tried a few different options and I’ve settled on keyd.

keyd provides more options simply mapping a key to act in two different modes, but that’s what I use it for. I use the following config to have caps lock act as ctrl if used as a modifier and escape if not. Tab is also set to act as a super key if used as a modifier and tab if not. Right control is mapped as f13, which I use as a second modifier for shortcuts in sway.

[ids]
*
[main]
capslock = overload(control, esc)
tab = overload(meta, tab)
rightcontrol = f13

[alt]
tab = A-tab

[ctrl]
tab = C-tab

[shift]
tab = S-tab
Enter fullscreen mode Exit fullscreen mode

The alt, ctrl, and shift modifiers are required to allow modifier+tab for windows management.

💖 💪 🙅 🚩
burnskp
Kevin Burns

Posted on July 23, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related