Repository navigation
Read the keyboard seat again when /dev/input changes instead of every 10 seconds - #15203
Merged
Merged
Conversation
… 10 seconds Hyprland raises no event when a keyboard arrives or leaves, so a seat with more than one keyboard was asked every 10s, per bar, for as long as the shell ran. One inotify watch of /dev/input announces each device instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
…eated /dev/input, and retry failed readings Addresses Codex review: udev can take longer than the settle delay, a watch on a deleted /dev/input never fires again, and a failed reading no longer had the old poll to recover it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the test shell before its watcher Addresses Greptile review: back-to-back nodes could not tell a restarted settle timer from a started one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rying a failing watcher Addresses Codex review: udev can finish with a device later than any fixed delay, which its /run/udev/data record marks, and an inotify setup failure gave up for good after five tries; it now backs off to once a minute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Codex review: a device arriving while the watcher restarted went unseen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Codex review: a device leaving between the widget's first reading and the watch going up went unseen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… instead of timing it Addresses Claude review: a watcher failing at once announced on every retry, so each bar asked Hyprland about once a second; the keyboard widget's fallback timer now covers a watch that keeps failing. The burst check compares the first signal with the last node rather than asserting on a 200ms margin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The keyboard layout widget ran
hyprctl -j devicesevery 10s, in each bar, for as long as the seat had more than one keyboard. That is most seats with an external keyboard, a KVM or a Bluetooth keyboard: this laptop has four, counting the GL.iNet KVM and fcitx5's virtual keyboard. The poll was there because Hyprland raises no event when a keyboard arrives or leaves. Its IPC event list hasactivelayoutandconfigreloaded, but no device events.What changed
Commons/InputDevices.qmlsingleton: oneinotifywaitfor the whole shell watching three places:/dev/input, where every keyboard the kernel sees (USB, Bluetooth via uhid, uinput) adds and removes its nodes;/run/udev/data'sc13:(input, major 13) records, which udev writes once it has finished with a device, i.e. when libinput hands it to Hyprland;/devitself, but only to re-arm the watch if/dev/inputis removed and recreated.changed()once a burst of events has been quiet for 500ms, and again 3s later, in case Hyprland trailed the event.inotify-toolsis already in the base packages.KeyboardLayout.qmlreads the seat again onInputDevices.changed. The 10s timer now runs only until a first reading lands, and while a reading leaves the seat in doubt. A failed or unparseable reading now counts as in doubt, so it is retried.keyboardCountwent with the old condition, since nothing else read it.OMARCHY_INPUT_ROOTpoints the watch at a fixture root, the wayOMARCHY_PROC_ROOT/OMARCHY_SYS_ROOTdo for/procand/sys.Testing
test/shell.d/input-devices-test.sh(compositor-gated) runs the singleton against a fixture root. It checks:/dev/inputis watched again;c13:udev record signals, and other records don't.settle.start()in place ofrestart(), no re-arm on recreate, and a settle that never fires each fail their check.hyprctl -j devicesallowance removed, on this four-keyboard seat: it passes, where quattro's shell spawnshyprctl -j devicesevery 10s.keyboard-layout-test.shandhyprland-keyboard-layout-test.shpass.For a human to check
/dev/inputnode. The widget already ignores it (isTypedKeyboard), and its layout changes still arrive asactivelayoutevents.hyprctl -j devicescan be dropped.🤖 Generated with Claude Code