Skip to content

Instantly share code, notes, and snippets.

@salopst
Last active October 1, 2023 06:01
Show Gist options
  • Save salopst/5458ed9b287d3a6acc8aba7d12db0972 to your computer and use it in GitHub Desktop.
Save salopst/5458ed9b287d3a6acc8aba7d12db0972 to your computer and use it in GitHub Desktop.
Stripped down KMonad keymapping just for laptop... the fecker with the busted up arrow. Maintains capslock-->ctrl, Vim keys on holding space, and spacecadet parens on shifts
#|
;; ---
;; title: MINIMAL config for KMonad on Lenovo Thinkpad T460
;; date: 2022-07-20T07:34:45+01:00
;; lastmod: 2023-10-01T04:14:46+0100
;; filename: $XDG_CONFIG_HOME/kmonad/t460-komnad.kbd
;; ---
;; ##### VERY STRIPPED DOWN CONFIGURATION FILE FOR KOMNAD -- T460 ONLY #####
\#
#| --------------------------------------------------------------------------
New layer Template for the Lenovo Thinkpad T460 (and friends):
(deflayer empty
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _
_ _ _
)
Note: Fn button is defined as 'wakeup' as defined by the `xev` tool.
-------------------------------------------------------------------------- |#
(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 T460
(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 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 150 \) 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
;; BASE-- no footering about except for pgup to up
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 z x c v b n m , . / @rpa
wkup lctl lmet lalt @spc ralt prnt rctl up up down
left down rght
)
(deflayer mod
;; Vim arrow keys with space
;; Emacs C-p/n/b/f also w/ space
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 right g left down up right ; ' ret
@lpa z x c v left down m , . / @rpa
wkup lctl lmet lalt @spc ralt prnt rctl up up down
left down rght
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment