Skip to content

Instantly share code, notes, and snippets.

@salopst
Created November 18, 2023 15:19
Show Gist options
  • Save salopst/9b2219c6de4818a853bffedab812878b to your computer and use it in GitHub Desktop.
Save salopst/9b2219c6de4818a853bffedab812878b to your computer and use it in GitHub Desktop.
MINIMAL config for KMonad on Lenovo Thinkpad T14-Gen3 (UK ISO)
#|
;; ---
;; title: MINIMAL config for KMonad on Lenovo Thinkpad T14-Gen3 (UK ISO)
;; author: salopst
;; date: 2023-09-23T013:24:25+01:00
;; lastmod: 2023-11-18T15:16:06
;; filename: $XDG_CONFIG_HOME/kmonad/t14g3-komnad.kbd
;; ---
;; ##### VERY STRIPPED DOWN CONFIG FOR KOMNAD -- Thinkpads (UK ISO) #####
;; US ANSI REPLACEMENT BOARD -- FRU 5N21D68058
;; ISO (UK) board is set to US input so shit is kinda in the usual spot "|\" key (102d)
;; is mapped to a second left shift. Under US input that key is "<>", but I got that anyway
;; with shifted , and .
# Add self to the input and uinput groups
sudo usermod -aG input $USER
sudo groupadd uinput
sudo usermod -aG uinput $USER
echo 'KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput"' | sudo tee /etc/udev/rules.d/90-uinput.rules
# This seems to be needed because uinput isn't compiled as a loadable module these days.
# See https://github.com/chrippa/ds4drv/issues/93#issuecomment-265300511
echo uinput | sudo tee /etc/modules-load.d/uinput.conf
|#
(defcfg
input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
output (uinput-sink "KMonad output"
;; To understand the importance of the following line, see the section on
;; Compose-key sequences at the near-bottom of this file.
"/usr/bin/sleep 1 && /usr/bin/setxkbmap -option compose:ralt")
cmp-seq ralt ;; Set the compose key to 'RightAlt'
cmp-seq-delay 5 ;; 5ms delay between each compose-key sequence press
fallthrough true ;; Unhandled events managed by keyboard default
allow-cmd false ;; Disable any command-execution in KMonad
)
;; THINKPAD T14 Gen 3 (UK ISO)
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 home end ins del
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 102d z x c v b n m , . / rsft
wkup lctl lmet lalt spc ralt prnt rctl pgup up pgdn
left down rght
)
(defalias
;; LAYOUT aliases
mod (layer-toggle mod) ;; Switching to the UHK mod layer
)
(defalias
;; KEY aliases
;;spc (tap-next-release spc (layer-toggle mod)) ;; hold space... hjkl and left-side numpad
spc (tap-hold 200 spc @mod) ;; hold space... hjkl → Vim keys/ npbf → Emacs keys
lpa (tap-hold 150 \( lsft) ;; tap LShift == left paren
rpa (tap-hold 75 \) rsft) ;; tap RShift == right paren
cbs (tap-hold 150 esc lctl) ;; tap CapsLock == escape | hold Ctrl
ret (tap-hold 150 ret rctl) ;; tap Enter == enter | hold Ctrl
hyp (around lctl (around lmet lalt)) ;; create vitual 'hyper' key.
)
(deflayer qwerty
;; (UK ISO )
;; 2nd @lpa replaces 102d -- fuck you short left shift
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 home end ins del
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ]
@cbs a s d f g h j k l ; ' \ @ret
@lpa @lpa z x c v b n m , . / @rpa
wkup lctl lmet lalt @spc ralt prnt rctl pgup up pgdn
left down rght
)
(deflayer mod
;; Vim arrow keys with space
;; Emacs C-p/n/b/f also w/ space
;; 2nd @lpa replaces 102d -- fuck you short left shift
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 home end ins del
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o up [ ]
@cbs a s d rght g left down up rght ; ' \ @ret
@lpa @lpa z x c v left down m , . / @rpa
wkup lctl lmet lalt @spc ralt prnt rctl pgup up pgdn
left down rght
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment