Trying out Kanata for one-shot modifiers and home row mods on Linux

| linux

Prot is a fan of one-shot modifiers. I started experimenting with them using keyd, but now I've moved to using kanata based on his recommendation. I also want to experiment with home row mods so that I can hold down:

  • f or j for shift
  • d or k for control
  • s or l for alt
  • or a or ; for super.

(Based on QWERTY home row, although Xmodmap translates it to Dvorak, where my home row keys are aoeu and htns.)

Here's my config:

  (defcfg
    process-unmapped-keys yes
  )
  (defsrc
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \
  caps a    s    d    f    g    h    j    k    l    ;    '    ret
  lsft z    x    c    v    b    n    m    ,    .    /    rsft
  lctl lmet lalt           spc            ralt rmet rctl
  )

  ;; define values for tap time and hold time
  (defvar
    tap-time 100
    hold-time 200
  )

  ;; alias definitions
  (defalias
    a (tap-hold $tap-time $hold-time a lmeta)
    s (tap-hold $tap-time $hold-time s lalt)
    d (tap-hold $tap-time $hold-time d lctrl)
    f (tap-hold $tap-time $hold-time f lshift)
    j (tap-hold $tap-time $hold-time j rshift)
    k (tap-hold $tap-time $hold-time k rctrl)
    l (tap-hold $tap-time $hold-time l ralt)
    ; (tap-hold $tap-time $hold-time ; rmeta)
    osshift (one-shot 60000 lshift)
    osctrl (one-shot 60000 lctrl)
    osalt (one-shot 60000 lalt)
    osralt (one-shot 60000 ralt)
    osmeta (one-shot 60000 lmet)
  )

  (deflayer base
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \
  @osctrl @a    @s    @d    @f    g    h    @j    @k    @l    @;    '    ret
  @osshift z    x    c    v    b    n    m    ,    .    /    @osshift
  @osctrl @osmeta @osalt           spc            @osralt _ @osctrl
  )

I followed the systemd instructions, so things should be loaded when I restart. To reload my config, I use C-c C-v C-t (org-babel-tangle) and then call systemctl --user restart kanata.service". Or actually, I have an Org Mode link of the form

[[elisp:(progn (org-babel-tangle) (shell-command "systemctl --user restart kanata.service"))][Update config]]

so I can just activate the link and have my new definitions loaded.

Resources:

View Org source for this post