Skip to content

Commit

Permalink
feat(kmonad): support multiple keyboards
Browse files Browse the repository at this point in the history
  • Loading branch information
KirkEasterson committed Nov 7, 2024
1 parent 8ccc92b commit e496ed9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
31 changes: 31 additions & 0 deletions kmonad/.config/kmonad/dactyl.kbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(defcfg
input (device-file "/dev/input/by-id/usb-izwan_zwactyl_50_vial:f64c2b3c-event-kbd")
output (uinput-sink "My KMonad output")

;; Comment this if you want unhandled events not to be emitted
fallthrough true

;; Set this to false to disable any command-execution in KMonad
allow-cmd false
)

(defsrc
caps a s d f g h j k l ;
)

(defalias
ctl_a (tap-hold-next-release 200 a lctl)
alt_s (tap-hold-next-release 200 s lalt)
met_d (tap-hold-next-release 200 d lmet)
sft_f (tap-hold-next-release 200 f lsft)

sft_j (tap-hold-next-release 200 j rsft)
met_k (tap-hold-next-release 200 k rmet)
alt_l (tap-hold-next-release 200 l ralt)
ctl_; (tap-hold-next-release 200 ; rctl)
)


(deflayer qwerty
esc @ctl_a @alt_s @met_d @sft_f g h @sft_j @met_k @alt_l @ctl_;
)
11 changes: 8 additions & 3 deletions kmonad/.config/kmonad/external_keyboard_script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/sh

device_name="platform-i8042-serio-0-event-kbd"
laptop="by-path/platform-i8042-serio-0-event-kbd"
dactyl="by-id/usb-izwan_zwactyl_50_vial:f64c2b3c-event-kbd"

if [ -e "/dev/input/by-path/${device_name}" ]; then
kmonad "${HOME}/.config/kmonad/config.kbd"
# This isn't an ideal solution. But the external keyboard gets high priority
# than the laptop keyboard, so check for that first.
if [ -e "/dev/input/${dactyl}" ]; then
kmonad "${HOME}/.config/kmonad/dactyl.kbd"
elif [ -e "/dev/input/${laptop}" ]; then
kmonad "${HOME}/.config/kmonad/laptop.kbd"
fi
File renamed without changes.

0 comments on commit e496ed9

Please sign in to comment.