Attempt to make modifier key changes take affect when the dialogue closes. This means you don't have to restart Fenrir to apply them.

This commit is contained in:
Storm Dragon committed 2026-10-29 18:27:20 -04:00
1 parent 15e04aa8f8
commit 22f6df6af9
23 files changed
+454 -58

No files matched your search

+1
View File
@@ -149,6 +149,7 @@ func (r *Router) Configure_modifiers(fenrirKeys, scriptKeys []string) error {
if err := candidate.Configure_scripts(scriptKeys, nil); err != nil {
return err
}
candidate.scriptBindings = r.scriptBindings
*r = candidate
return nil
}
+17
View File
@@ -94,3 +94,20 @@ func TestCapsLockScriptModifierKeepsShiftToggle(t *testing.T) {
t.Fatal("script chord toggled capitalization", got)
}
}
func TestModifierReconfigurationPreservesInstalledScriptBindings(t *testing.T) {
r := desktop_router(t)
if err := r.Configure_modifiers([]string{"KEY_INSERT"}, []string{"KEY_COMPOSE"}); err != nil {
t.Fatal(err)
}
if err := r.Configure_scripts([]string{"KEY_COMPOSE"}, []ScriptBinding{{ID: "script:example", Keys: []string{"KEY_SCRIPT", "KEY_U"}}}); err != nil {
t.Fatal(err)
}
if err := r.Configure_modifiers([]string{"KEY_META"}, []string{"KEY_CAPSLOCK"}); err != nil {
t.Fatal(err)
}
r.Key(0, KeyCapsLock, 1, false, false)
if got := r.Key(0, 22, 1, false, false); got.Command != "script:example" {
t.Fatal("script binding lost", got)
}
}
+3
View File
@@ -134,6 +134,9 @@ func (r *Router) Forwarded(device int) []uint16 {
return keys
}
// Idle reports whether all devices have released their routed keys.
func (r *Router) Idle() bool { return r.empty() }
// Held reports physical state for one device, including consumed keys whose
// release has not arrived yet.
func (r *Router) Held(device int) bool { return len(r.keys[device]) != 0 }