From 087d7963e880367f35e17019085afecf9a37f58a Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Sun, 12 Oct 2025 22:41:37 -0400 Subject: [PATCH] feat: Adds mouse layer to kanata config, adds stop command to kanatactl script. --- env/.config/kanata/config.kbd | 46 ++++++++++++++++++++++++++++++++--- env/.local/scripts/kanatactl | 13 +++++++++- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/env/.config/kanata/config.kbd b/env/.config/kanata/config.kbd index a0742ad..429963b 100644 --- a/env/.config/kanata/config.kbd +++ b/env/.config/kanata/config.kbd @@ -13,6 +13,8 @@ log-layer-changes no danger-enable-cmd yes concurrent-tap-hold yes + rapid-event-delay 3 + allow-hardware-repeat false ;; When any non-chord activation happens, this timeout begins. Until this timeout expires ;; all inputs will immediately skip chords processing and be processed by the active layer. @@ -23,6 +25,8 @@ (defvar tap-higher 400 tap-time 200 + tap-time-plus 300 + hold-time-plus 300 hold-time 200 chord-time 60 subl-time 200 @@ -59,8 +63,13 @@ mretu (tap-hold $tap-time $hold-time tab ret) - mlnums (tap-hold-press $tap-time $hold-time esc (layer-while-held nums_and_symbols)) - mrnums (tap-hold-press $tap-time $hold-time ret (layer-while-held nums_and_symbols)) + ;; number and symbols layer trigger keys. + mlnums (tap-hold-press $tap-time-plus $hold-time-plus esc (layer-while-held nums_and_symbols)) + mrnums (tap-hold-press $tap-time-plus $hold-time-plus ret (layer-while-held nums_and_symbols)) + + ;; mouse layer trigger keys. + mlms (tap-hold-press $tap-time $hold-time lsft (layer-while-held mouse)) + mrms (tap-hold-press $tap-time $hold-time rsft (layer-while-held mouse)) ;; Multi mhypr (tap-hold $tap-time $hold-time spc (multi lsft lctl lalt lmet)) ;; Hyper key @@ -98,7 +107,7 @@ grv 1 2 3 4 5 6 7 8 9 0 - = bspc tab q w e r t y u i o p [ ] \ @mlnums @mlctl @mlalt @mlmet @mlsft g h @mrsft @mrmet @mralt @mrctl ' @mrnums - lsft z x c v b n m , . / ▲ rsft + @mlms z x c v b n m , . / ▲ @mrms lctl lalt lmet spc rmet ralt ◀ ▼ ▶ ) @@ -111,3 +120,34 @@ lsft S-7 S-8 S-4 S-3 XX XX 7 8 9 / XX rsft lctl lalt lmet 0 rmet ralt ◀ ▼ ▶ ) + +(defalias + mwu (mwheel-up 50 120) + mwd (mwheel-down 50 120) + mwl (mwheel-left 50 120) + mwr (mwheel-right 50 120) + + ms↑ (movemouse-up 1 1) + ms← (movemouse-left 1 1) + ms↓ (movemouse-down 1 1) + ms→ (movemouse-right 1 1) + + ma↑ (movemouse-accel-up 5 1000 1 3) + ma← (movemouse-accel-left 5 1000 1 3) + ma↓ (movemouse-accel-down 5 1000 1 3) + ma→ (movemouse-accel-right 5 1000 1 3) + + sm (setmouse 32228 32228) + + fst (movemouse-speed 200) +) + +;; Mouse and arrow layer +(deflayer mouse + esc XX XX XX XX XX XX XX XX XX XX XX XX ;; function row + grv XX XX XX XX XX XX XX XX XX XX XX XX bspc ;; number row + tab XX XX ▲ XX XX @mwl @mwd @mwu @mwr XX XX XX XX ;; top letter row + caps XX ◀ ▼ ▶ XX @ma← @ma↓ @ma↑ @ma→ XX XX mrtp ;; home row + lsft XX XX XX XX XX XX XX XX XX XX XX rsft ;; bottom letter row + lctl lalt lmet mltp rmet ralt XX XX XX ;; control row +) diff --git a/env/.local/scripts/kanatactl b/env/.local/scripts/kanatactl index b7d4d80..50f903b 100755 --- a/env/.local/scripts/kanatactl +++ b/env/.local/scripts/kanatactl @@ -34,6 +34,7 @@ COMMANDS: restart: Restart the kanata systemd service. start: Enable and start the kanata systemd service. status: Get the status of the kanata systemd service. + stop: Stop the kanata systemd service. update: Pull from git and check for updates. EOF @@ -177,10 +178,16 @@ get_status() { systemctl status kanata.service } +# Stop the service. +stop_service() { + log "Stopping kanata service..." + sudo systemctl stop kanata.service +} + # Disable the kanata systemd service. disable_service() { log "Disabling kanata service..." - sudo systemctl stop kanata.service + stop_service sudo systemctl disable kanata.service } @@ -244,10 +251,14 @@ while [[ $# -gt 0 ]]; do bat ${LOG_DIR:-/tmp/logs}/$LOG_FILE && exit 0 elif [[ $1 == "status" ]]; then get_status && exit $? + elif [[ $1 == "stop" ]]; then + stop_service && exit $? elif [[ $1 == "restart" ]]; then restart_service && exit 0 elif [[ $1 == "update" ]]; then install_or_update "Updating" && exit 0 + else + break fi done