feat(keyboard): interactive new-keyboard layout prompt + persist
The runtime-remember complement to nomarchy.keyboard.devices. Set nomarchy.keyboard.layouts (candidate layouts) and a nomarchy-keyboard-watch daemon runs (exec-once): it polls hyprctl devices, and when a keyboard connects after login that isn't declared and hasn't been chosen before, it pops a rofi layout picker, applies the choice via hyprctl switchxkblayout (an index into the candidate set carried by input.kb_layout), and remembers it per-device in ~/.local/state -- re-applied silently on later reconnects. The boot-time set (incl. the built-in keyboard) is never prompted. Pure bash + jq/hyprctl/rofi (all in the session PATH); state lives outside the flake (a stateful runtime piece by design). Eval + bash-syntax verified; the hotplug behaviour needs an on-hardware test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -96,6 +96,22 @@ in
|
||||
description = "XKB variant for the Hyprland session.";
|
||||
};
|
||||
|
||||
keyboard.layouts = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
example = [ "de" "fr" ];
|
||||
description = ''
|
||||
Extra candidate layouts offered by the interactive new-keyboard
|
||||
picker. When non-empty, a small watcher runs in the session: when a
|
||||
keyboard connects that isn't covered by nomarchy.keyboard.devices and
|
||||
hasn't been chosen before, it pops a rofi picker (these layouts plus
|
||||
the primary nomarchy.keyboard.layout), applies the choice, and
|
||||
remembers it per-device (~/.local/state) — re-applying automatically
|
||||
on later reconnects. The runtime-remember complement to the
|
||||
declarative keyboard.devices; a stateful runtime piece by design.
|
||||
'';
|
||||
};
|
||||
|
||||
keyboard.devices = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
options = {
|
||||
|
||||
Reference in New Issue
Block a user