Repository navigation
Fix KeyboardLayout plugin label permanently displaying ENG on some systems - #6646
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes #6574 by selecting Hyprland’s main keyboard when displaying the active layout.
Changes:
- Parses
hyprctloutput as JSON. - Uses the keyboard marked
maininstead of the first reported device.
Tip
If you aren't ready for review, convert to a draft PR. Click "Convert to draft" or run gh pr ready --undo.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
find(k => k.main) returning nothing fell through to keyboards[0], which is the case the fix is for: on hardware whose first device is a permanently English (US) radio-control keyboard, the label was wrong and the 10s poll kept it wrong. The seat can also hold no active keyboard while a device is re-added, and older Hyprland has no main field at all. Keep the last known value instead, and skip entries without an active_keymap, since assigning undefined to the string property throws before the label is ever set. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The shell wrapper only existed for a pipeline that is gone, so spawn the command directly, as Style.qml already does for its own hyprctl query. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Every Omarchy install runs fcitx5 for ~/.XCompose, and it binds a virtual keyboard that takes the seat's main flag whenever it injects. That keyboard keeps the us layout the input method gave it, so on a machine configured for another layout the widget flipped to ENG and the poll kept it there until the next physical keypress. Skip virtual keyboards and hold the last known layout instead, which the next poll corrects once a real keyboard is active again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
shell/plugins/bar/widgets/KeyboardLayout.qml:23
- This predicate cannot handle the fcitx5 case described immediately above it: once
hl-virtual-keyboardowns the seat'smainflag, no non-virtual keyboard satisfies both conditions, so the later.find(...)returnsundefinedand the widget keeps a stale label. The prefix also identifies Hyprland virtual keyboards generally, not only fcitx5, so virtual-keyboard-only setups lose the label entirely. Select/remember the physical device associated withactivelayoutevents, while retaining the main virtual keyboard as a fallback when no physical candidate exists.
return kb.main && !String(kb.name).startsWith("hl-virtual-keyboard")
Holding a frozen label while fcitx5 owns the main flag went stale as soon as the layout changed underneath it, and cycling still dispatched against "current", which is that same virtual keyboard. Remember the keyboard the label came from, re-read its layout on every poll, and cycle it by name so the widget shows and switches one device. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nick1udwig
pushed a commit
to nick1udwig/omarchy
that referenced
this pull request
Sep 9, 2026
…stems (omacom#6646) * Fix hyprctl output parsing in KeyboardLayout plugin * Never fall back to a non-active keyboard for the layout label find(k => k.main) returning nothing fell through to keyboards[0], which is the case the fix is for: on hardware whose first device is a permanently English (US) radio-control keyboard, the label was wrong and the 10s poll kept it wrong. The seat can also hold no active keyboard while a device is re-added, and older Hyprland has no main field at all. Keep the last known value instead, and skip entries without an active_keymap, since assigning undefined to the string property throws before the label is ever set. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Run hyprctl directly from the keyboard layout widget The shell wrapper only existed for a pipeline that is gone, so spawn the command directly, as Style.qml already does for its own hyprctl query. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Read the layout from the keyboard the user types on Every Omarchy install runs fcitx5 for ~/.XCompose, and it binds a virtual keyboard that takes the seat's main flag whenever it injects. That keyboard keeps the us layout the input method gave it, so on a machine configured for another layout the widget flipped to ENG and the poll kept it there until the next physical keypress. Skip virtual keyboards and hold the last known layout instead, which the next poll corrects once a real keyboard is active again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * Keep tracking the keyboard the layout was last read from Holding a frozen label while fcitx5 owns the main flag went stale as soon as the layout changed underneath it, and cycling still dispatched against "current", which is that same virtual keyboard. Remember the keyboard the label came from, re-read its layout on every poll, and cycle it by name so the widget shows and switches one device. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- Co-authored-by: David Heinemeier Hansson <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Fixes #6574
Keyboard layout bar widget polls the current keyboard layout with a regex/sed combo from the output of
hyprctl -j devices. The list includes every input device that libinput/evdev exposes with the EV_KEY capability, e.g. power button and multimedia keys.In my case, on Framework 13 Pro, the first occurrence of
active_keymapis found under keyboard devicefrmw0004:00-32ac:0006-wireless-radio-control- a device that never receives the toggle and stays permanently inEnglish (US)layout, causing the plugin to permanently display "ENG" regardless of the actual keyboard layout.This PR replaces the regex/sed scrape of
hyprctl -j deviceswith proper JSON parsing that picks the keyboard flaggedmain: true, which seems to correctly track whichever device's layout is actually switched.