Mapping Ctrl, Alt, Shift, and GUI to the homerow

inspired by this article i installed kmonad and did GACS with a 350 ms trigger

i find this extremely ergonomic. using the default emacs keybindings is generally excellent, but i believe that anyone who uses modifier keys (which is, i imagine, everyone) would benefit

after putting the binary in my user path i define the kmonad.service at /etc/systemd/system/kmonad.service

Description=KMonad keyboard tool

ExecStart=/usr/local/bin/kmonad /home/max/.config/kmonad/homemod.kbd


this is the homemod.kbd file:

  ;; For Linux
  input  (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
  output (uinput-sink "My KMonad output")
  ;; This option tells KMonad to let non-configured keys act normal
  fallthrough true
    a    s    d    f    g    h    j    k    l    ;
    met_a (tap-hold-next-release 350 a lmet)
    alt_s (tap-hold-next-release 350 s lalt)
    ctl_d (tap-hold-next-release 350 d lctl)
    sft_f (tap-hold-next-release 350 f lsft)

    sft_j (tap-hold-next-release 350 j rsft)
    ctl_k (tap-hold-next-release 350 k rctl)
    alt_l (tap-hold-next-release 350 l lalt)
    met_; (tap-hold-next-release 350 ; rmet)
(deflayer homerowmods
    @met_a   @alt_s   @ctl_d   @sft_f   g   h   @sft_j   @ctl_k   @alt_l   @met_;

this defines the map for my laptop keyboard; i have other .kbd files with different input device-file definitions for my desktop keyboard and the bluetooth keyboard i use out and about. i manually stop the kmonad service and run the binary with the proper .kbd file, e.g.

sudo systemctl stop kmonad && sudo kmonad ~/.config/kmonad/homemodBT.kbd

this is probably common knowledge around these parts, but doing this and getting used to it was a real turning point for me and i like to tell people about it

1 Like

Thanks for sharing, I also use homerow mods and love it. It does make me look silly trying to use a regular keyboard/typing on someone else’s laptop, but totally worth it!

A small suggestion: I’d recommend not running keyboard mappers as sudo since it gives the whole process root access. I use Kanata (same idea) as a userlevel systemd service.

I love this idea, but when I tried doing it with my keyboard, it caused a lot of typing mistakes for me, i.e. presses registering as modifiers instead of input characters.

A similar thing happened when I tried using spacebar as a modifier key. Since the timeout has to be respected, when I was inputting a space instead of using it as a modifier, the space didn’t appear until I released the spacebar, and that caused a lot of missing spaces between words; it happened so much that it was impractical for me.

I don’t think my typing is that sloppy; I don’t make many typing mistakes otherwise (at least, not of that kind), so I’m not sure what the problem is. Maybe I could find a sweet spot for the timeout value to make it work, but it just seemed so error-prone to me that I gave up on the idea.

Any tips or obvious mistakes I might have made? It seems to work for some people…

@alphapapa I feel like there are three parts to it: getting used to it, tuning the tap-hold times (perhaps even per finger/modifier), and picking the right remapper for your preferences (especially for repeat character handling).

See the double tapping links. On my split keyboard I have space and backspace as my thumb (1.5u size) keys and they’re my primary layer shifting keys. I do sometimes accidentally inject spaces or delete things but it’s rare, it was happening more at first. But maybe space bar isn’t the best modifier key for you since it is the most frequently pressed key?!

I’m sure you’re doing this already but it took me a bit of discipline to ensure that I was using the opposite hand for holding the modifier from the hand that was pressing the key. Happy to chat more details!

1 Like