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 these keys or use them as one-shot modifiers:

  • 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 300
    one-shot-timeout 2000
  )

  ;; alias definitions
  (defalias
a (tap-hold $tap-time $hold-time a (one-shot $one-shot-timeout lmet))
  s (tap-hold $tap-time $hold-time s (one-shot $one-shot-timeout lalt))
  d (tap-hold $tap-time $hold-time d (one-shot $one-shot-timeout lctrl))
  f (tap-hold $tap-time $hold-time f (one-shot $one-shot-timeout lshift))

  j (tap-hold $tap-time $hold-time j (one-shot $one-shot-timeout rshift))
  k (tap-hold $tap-time $hold-time k (one-shot $one-shot-timeout rctrl))
  l (tap-hold $tap-time $hold-time l (one-shot $one-shot-timeout ralt))
  ; (tap-hold $tap-time $hold-time ; (one-shot $one-shot-timeout rmeta))
btm-ctrl (tap-hold-press $tap-time $hold-time (one-shot $one-shot-timeout lctrl) lctrl)
    btm-meta (tap-hold-press $tap-time $hold-time (one-shot $one-shot-timeout lmet)  lmet)
    btm-alt  (tap-hold-press $tap-time $hold-time (one-shot $one-shot-timeout lalt)  lalt)

    btm-ralt (tap-hold-press $tap-time $hold-time (one-shot $one-shot-timeout ralt)  ralt)
    btm-rmet (tap-hold-press $tap-time $hold-time (one-shot $one-shot-timeout rmet)  rmet)
    btm-rctl (tap-hold-press $tap-time $hold-time (one-shot $one-shot-timeout rctrl) rctrl)
  )

(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    [    ]    \
  caps @a   @s   @d   @f   g    h    @j   @k   @l   ;    '    ret
  lsft z    x    c    v    b    n    m    ,    .    /    rsft
  @btm-ctrl @btm-meta @btm-alt           spc            @btm-ralt @btm-rmet @btm-rctl
  )

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