Mastodon hachyterm.io

Why Colemak?

In short: better coding experience. The standard Germany keyboard layout (QUERTY) is not helpful for my coding flow.
Many keys are hard to reach, for example, the backslash (\).

I chose Colemak as my keyboard layout.
Colemak offers support for multiple languages is more ergonomic than the standard layout and reasonably easy to learn.

Adjust Keyboard With XKB For Linux

Damiano Venturin wrote an excellent guide on XKB for Linux that explains XKB.

Most graphical environments for Linux (KDE, Xfce, i3, …) use X and XKB to define keyboard codes and layouts.

You can do that by using the command setxkbmap.

For i3, you can define a command in your i3 config (~/.i3/config):

exec --no-startup-id setxkbmap -model pc104 -layout us,de -variant colemak, -option 'grp:alt_shift_toggle,shift:both_capslock,terminate:ctrl_alt_bksp,ctrl:nocaps'

The command creates two setups for a US keyboard with Colemak, a German standard QUERTY keyboard, and adds some additional perks. For example, if you press both shift keys, you’ll get capslock. You can switch between both layouts with alt+shift+toggle.

At-Home-Modifier

It enables for example “Space/Shift dual role key.” When you press the Space key alone, it’s a space; but when you press it with another key, it’s a shift. E.g., space + x = X, roughly speaking.

It only works for Linux, but Mac and Windows offer alternatives.

Arch has an AUR package that’s also available for Manjaro:

pacman -S xf86-input-evdev-ahm

Now you have tell your OS that you want to use the evdev driver.

Check the XKB guide for further details. I adjusted my keyboard settings in /etc/X11/xorg.conf.d/00-keyboard.conf:


Section "InputClass"
Identifier "system-keyboard"
+Driver "evdev"
+MatchIsKeyboard "on"
Option "XkbLayout" "us"
Option "XkbVariant" "colemak,"
Option "XkbOptions" "shift:both_capslock,ctrl:nocaps"
+Option "TransMod" "65:50 102:241"
EndSection

We set the keyboard driver to “evdev” and add options for AHM. The system should handle the rest. We took care of it by configuring our i3 config file.

Further Reading