(Thanks keyboard-layout-editor.com for the image!)
Keyboard settings bringing hardly-reachable keys to your home row (or as close to it as possible):
- arrows, page up/down, home/end;
- control and alt (hello, emacsers);
- delete, backspace;
- f-keys;
- even jump-to-next/previous-word and delete-next/previous-word;
- tilde, backquote, underscore, hyphen and equals;
- esszet and umlauts for latin layout, serbian/ukrainian/belorussian letters for cyrillic layout (works only on linux).
Tested on Linux but should work on Windows and Mac too, thanks KMonad.
To forget about moving hands away from the home row every time you need to do something besides character input (which is quite often: move to the next line, fix a typo, even go out of insert mode in your favourite editor).
Of course, one can (and should) use a good editor which takes these problems off. But hey, isn’t it cool to have a minimal set of features of this good editor in EVERY app? In every web browser, email client, table and text processors, messengers and password keepers, file managers and music players. In every place on your screen which is supposed to input something in.
My own killer examples are Jupyter Notebook web app and Freeplane mindmap utility. I love these apps but they do not and probably never will provide as good keyboard-only user experience as in vim or spacemacs.
Another benefit is that you will never suffer because of a non-standard keyboard in your new laptop. (Actually, the layout is mostly standard, so even occasional hacking on other people’s setups doesn’t bring much pain.)
And you can have all these goodies both on Linux, Windows and Mac. (Ok, for the last two you have to hack around a bit, but I’ve done it once for those systems so it’s possible, and you have a good working example).
Of course there are disadvantages:
- you will suffer a little (but not that much) each time you work on someone else’s computer for a long time (but you can do a good deed and supply them with the layout ;)
- you will need to get familiar with new settings
On linux (X11):
- Find out what is your keyboard name in
/dev/input/by-id/
folder and write it into./kmonad/main.kbd
file. If you can’t find it, use evtest and xinput to find out its vendor and add anudev
rule to tell linux to add an alias for your keyboard. - Install
komnad
and addkmonad ./kmonad/main.kbd
to your preferred autolauncher (there’ssystemd
service template for your convenience). - Put this line into your .xprofile or whatever:
xkbcomp -I"$HOME/.config/xkb" $HOME/.config/xkb/my $DISPLAY
There are two layers: navigational one and one for digits and symbols.
To activate navigational layer, press and hold CapsLock button:
Simple remappings:
ikjl
= up/down/left/right arrows<
= home,>
= endp
= page up,;
= page downd
= backspace,f
= deleteg
= escape,h
= return- many useful symbols missing on non-English layout (say Cyrillic one) — symbols can be inserted from the overlay layer with no layout switching.
You even can press Caps+Shift with your left pinky to select text, enter uppercase characters or use some advanced hotkeys.
Combos:
u
= ctrl-left (usually jump to the beginning of the word),o
= ctrl-right (usually jumps to the end of the word);e
= ctrl-backspace (usually deletes from the cursor to the beginning of the word),r
= ctrl-delete (usually deletes from the cursor to the end of the word).
Home-row functional keys:
- when you tap the key, it sends the letter which is written on it;
- if you hold it, it works as modifier key.
Sometimes it leads to mis-hits (as Ctrl-R when you type “keybo**ar**d”), but for programming needs those caveats are greatly overweighted. Still you can disable home-row functional keys by editing main.kbd
.
There’s a small digits layer which places all digits near the home row on the right part of the keyboard. To activate digits layer, hold space. You can add extra symbols on this layer, see main.kbd
.
Since we have Level3 shift instead of rarely-used right control, we can map extra keys right onto the main part of the keyboard. In my version, there are:
- german symbols (ß, ä, ö, ü) on s, a, o, u keys;
- cyrillic symbols from serbian, ukraininan and belorussian layouts (ўЎ њЊ ґҐ ћЋ їЇ іІ љЉ ђЂ єЄ).
(This feature currently works only on Linux, but you can write an autohotkey/karabiner scripts for Windows and MacOS.)
On Linux, Kmonad works close to the kernel, which means lesser latency and more stability: no more glitches in too-clever app frameworks like Java Swing or Electron. Also, separating layout in two parts makes debugging easier: you don’t fear to ruin your xkb
part and lose ability to enter basic symbols.
What’s more important, kmonad
is cross-platform.
And, what’s even more important, kmonad
makes home-row modifers and other nice tricks previously possible only on QMK-based keyboards, available on any standard keyboard, including laptop keyboards.
Your desktop environment may try to manage layouts by itself. I faced this problem on XFCE4 when tried to get keyboard layout indicator work.
On XFCE, it helped to remove all the layouts from XFCE keyboard manager, keeping the only English layout. It made XFCE stop switching layout by itself and ruining my settings. This is very inconvenient, but for now I haven’t found the proper solution, sorry.
Some good resources on XKB:
- https://www.x.org/archive/X11R7.5/doc/input/XKB-Enhancing.html
- https://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html
- archlinux xkb page, good explanations and lots of examples
Interesting keyboard layouts:
- Ilya Birman’s typography layout — for designers and text writers who care about quotes, dashes, and so on.
- The idea to remap semicolon was taken from abo-abo’s emacs config, but I used left pinky for movement keys and the right pinky for modifiers.