From 3dd0d3f11cdd68d6d27e54a315c3e91dfb84b03e Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 10 Sep 2024 14:17:55 +0100 Subject: [PATCH] ignore num lock state when recognising keys --- keymap.fnl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/keymap.fnl b/keymap.fnl index 40be3d6..08f56c7 100644 --- a/keymap.fnl +++ b/keymap.fnl @@ -19,6 +19,7 @@ :Super_R ; menu key? not on my keyboard :Alt_L :Alt_R + :Num_Lock :ISO_Level3_Shift ; AltGr ]] (collect [_ n (ipairs names)] @@ -27,6 +28,10 @@ (fn modifier? [keyval] (. modifier-keyvals keyval)) +(fn ignored-modifier? [mod] + (= mod :MOD2_MASK) ; numlock + ) + (fn keychord->spec [keychord] (let [Mod Gdk.ModifierType symbol (keychord:match "(%w+)$") @@ -49,7 +54,9 @@ (let [modmask (accumulate [m 0 k _ (pairs event.state)] - (bor m (. Gdk.ModifierType k)))] + (if (ignored-modifier? k) + m + (bor m (. Gdk.ModifierType (trace k)))))] (spec->index {:keyval event.keyval : modmask}))) (fn compact [xs]