hl.device() has no getter — a plugin cannot read back a device's enabled state #15885
Replies: 2 comments
|
Seconded, and same thing for mice please. This would work: Happy to send a PR if this goes in the direction the dev team wants to go. |
0 replies
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
hl.device({ name = <dev>, enabled = <bool> })sets an input device'senabledflag at runtime, but there is no counterpart to read it back. Every path I could find either always reports the same value regardless of state, or doesn't expose the field at all.Why this matters
I maintain a small Omarchy plugin (https://github.com/roymelgarv/omarchy-keyboard-cleaner) that disables input devices via
hl.device()so a keyboard can be safely wiped down. The plugin tracks lock/unlock state itself, but has no way to confirm against Hyprland that a disable actually landed, or that an unlock actually cleared it — it can only trust its own bookkeeping. That matters more than usual here: a bug in that bookkeeping (which I did hit) can silently strand a real keyboard with no way for the plugin, or a person debugging it, to detect the mismatch by asking Hyprland directly.What I tried (Hyprland 0.56.2)
hyprctl devices -j→ the JSON does carry anenabledkey per device, but it isnullfor every device unconditionally — including while a device is demonstrably disabled viahl.device()moments earlier. It never reflects real state.hl.get_config('device:<name>:enabled')andhl.get_config('device[<name>]:enabled')→ both returnnil. Ruled out a broken call:hl.get_config('input:kb_layout')on the same session correctly returns the configured layout, so the reader itself works —device:enabledspecifically isn't exposed through it.hyprctl getoption 'device[<name>]:enabled'→no such option.hl.*table: there are getters for monitors, windows, workspaces, layers (get_monitors,get_windows,get_workspaces,get_layers, ...), butdeviceitself is a bare setter with nothing beside it.Related but distinct
#5724 covers
hyprctl getoptionnot supportingdevice:*for config-declared values, closed as a known hyprlang-migration tradeoff. This is narrower and Lua-specific: even a value set purely at runtime throughhl.device()(never touching a config file at all) has no way to be read back through the Lua API either. Ahl.get_device(name)(or anenabledfield that's actually populated inhyprctl devices -j) would close both gaps for anyone driving devices from a plugin.Ask
A read path for a device's
enabledstate — ideallyhyprctl devices -jactually populating the field, since that's the zero-migration fix for every existing consumer, but ahl.get_device()Lua getter would also work for plugins.Happy to test against a branch if useful.
All reactions