CapsLock Fix

Following a suggestion on YouTube, I added kanata for far1.

Download kanata

From https://github.com/jtroo/kanata/releases

Move to /usr/local/bin

mv Downloads/kanata /usr/bin/local
chown root:root /usr/bin/local/kanata
chmod +x /usr/bin/local/kanata

Make a systemd service

Created a service file at ~/.config/systemd/user/kanata.service, containing:

[Unit]
Description=Kanata keyboard remapper
Documentation=https://github.com/jtroo/kanata

[Service]
Environment=PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin
Environment=DISPLAY=:0
Environment=HOME=/home/baz
Type=simple
ExecStart=/usr/local/bin/kanata --cfg /home/baz/.config/kanata/kanata.conf
Restart=no

[Install]
WantedBy=default.target

Started and made permanent with the lines from https://github.com/jtroo/kanata/discussions/130

systemctl --user start kanata.service # to start kanata daemon
systemctl --user enable kanata.service # so it may autostart whenever the current user logs in.
systemctl --user status kanata.service # to check if kanata daemon is running or not.

Created a basic config file

created a file at /home/baz/.config/kanata/kanata.conf, containing:

;; Caps to escape/control configuration for Kanata

(defsrc
  caps
)

(defalias
  escctrl (tap-hold 100 100 esc lctl)
)

(deflayer base
  @escctrl
)

This is copied from https://github.com/dreamsofcode-io/escapecontrol/blob/main/linux/kanata/caps2esc.kbd

A Better Config

To avoid the ACCIDENTAL CAPS FOREVER issue the following config just capitalises the next word when caps-lock is tapped. To put it on permanenently press and hold for a second:

(defsrc
  esc  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 
)

(defalias
  escctrl (tap-hold 200 1000 (caps-word 2000) caps)
)

(deflayer base
  esc  1    2    3    4    5    6    7    8    9    0    -    =    bspc
  tab  q    w    e    r    t    y    u    i    o    p    [    ]   
  @escctrl  a    s    d    f    g    h    j    k    l    ;    '    ret
  lsft \ z    x    c    v    b    n    m    ,    .    /    rsft
  lctl lmet lalt           spc            ralt 
)

It seems that caps-word only works for keys which are in defsrc, so I had to list all keys.