Skip to content

Latest commit

 

History

History
133 lines (96 loc) · 3.87 KB

kmonad.org

File metadata and controls

133 lines (96 loc) · 3.87 KB

Kmonad

Kmonad is a keyboard remapping tool which provides similar features to QMK, but at the software level.

Setup

sudo usermod -aG input $USER
sudo groupadd uinput

echo 'KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput"' | sudo tee /etc/udev/rules.d/90-uinput.rules

echo uinput | sudo tee /etc/modules-load.d/uinput.conf

Keyboard

You need to set the device file, which will be different for every keyboard.

Look in /dev/input/by-id/ or /dev/input/by-path for the builtin laptop keyboard.

  • input (device-file “/dev/input/by-path/platform-i8042-serio-0-event-kbd”)
  • input (device-file “/dev/input/by-id/usb-MOSART_Semi._PERIDUO-606-event-kbd”)
(defcfg
  input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
  output (uinput-sink "KMonad kbd")
  fallthrough true
  allow-cmd true)

Blueprint

This is the base blueprint for your keyboard, it should match your keyboards specific layout.

I use a weird split ergo keyboard, so your layout is almost definitely different.

(defsrc
  esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 prnt del
  ` 1 2 3 4 5 6 7 8 9 0 -  =  bspc home
  tab q w e r t y u i o  p [ ] \ end
  caps a s d f g h j k l ; ' \ ret pgup
  lsft z x c v b n m , . / rsft up pgdn
  lctl lmet lalt spc ralt cmps rctl left down rght
)

Aliases

Sticky Shifting

Changes the behaviour of the shift key (left or right). On hold it acts like a normal shift, but when pressed it toggles “shifting” for one press.

So “shift j” will ouput J, and so will “shift+j”. This saves you from doing awkward finger gymnastics when typing things like “&”. It also flows nicely when Capitalizing Words.

(defalias
  sym (layer-toggle symbols)
  ssft (around-next sft)
  ssft+sft (tap-next @ssft sft))

Toggle Layer by Holding Down Space

Toggle the symbol layer by holding down space. Holding down the spacebar is mostly useless, and I don’t mind tapping multiple times the odd time I need to.

Tapping space works exactly as expected, except that spc is on key up instead of key down. I don’t really notice the difference. When holding spc the symbols layer will be active.

One way that I use this is to map the arrow keys to hjkl when spc is held.

(defalias
  symspace (tap-hold 200 spc @sym))

Actually Useful Caps Key

I never use caps-lock. I map it to ctrl to avoid contracting Emacs pinky.

Also, make it esc on tap because nobody taps ctrl.

(defalias
  ctl+esc (tap-next esc lctl))

Home Row Mods

Holding home row key to use mod keys.

(defalias
  fctl (tap-hold 200 f lctl)
  dmod (tap-hold 200 d lmet)
  salt (tap-hold 200 s lalt)

  jctl (tap-hold 200 j rctl)
  kmod (tap-hold 200 k lmet)
  lalt (tap-hold 200 l ralt)
)

Layouts

Here we add the layouts we want, based on the source layout.

(deflayer base
  esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 prnt del
  ` 1 2 3 4 5 6 7 8 9 0 -  =  bspc home
  tab q w e r t y u i o  p [ ] \ end
  @ctl+esc a @salt @dmod @fctl g h @jctl @kmod @lalt ; ' \ ret pgup
  @ssft+sft z x c v b n m , . / @ssft+sft up pgdn
  lctl lmet lalt @symspace @sym cmps rctl left down rght
)

(deflayer symbols
  esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 prnt del
  ` 1 2 3 4 5 6 7 8 9 0 -  =  bspc home
  tab q w e r t y u i o  p [ ] \ end
  lctl a s d f g left down up rght : ' \ ret pgup
  lsft z x c v b n m , . / rsft up pgdn
  lctl lmet lalt spc ralt cmps rctl left down rght
)