Add a keyboard layout switch command with an OSD readout - #6517
Open
kmpeeduwee wants to merge 1 commit into
Open
Add a keyboard layout switch command with an OSD readout#6517kmpeeduwee wants to merge 1 commit into
kmpeeduwee wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a Hyprland keyboard-layout command with OSD feedback and status reporting.
Changes:
- Adds next, previous, and status actions.
- Adds shell tests for dispatching, OSD output, and invalid actions.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bin/omarchy-hyprland-keyboard-layout |
Implements layout switching and reporting. |
test/shell.d/keyboard-layout-test.sh |
Tests command behavior and main-keyboard selection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Why
Volume, brightness, and media keys all answer through the OSD, but switching the keyboard layout answers with nothing: bind
hyprctl switchxkblayoutand the only way to find out which layout you landed on is to type something and see what comes out. With two layouts that means guessing wrong half the time; with more, worse.What this adds
omarchy-hyprland-keyboard-layout [next|prev|status]— the same shape asomarchy-audio-output-volume: perform the change, then show the result on the OSD.next/prevdispatchswitchxkblayout alland pop the OSD with the keyboard glyph and the new layout's name as xkb reports it — "English (US)", "Portuguese (Brazil)", "German (dead acute)", whatever is configured.statusprints the active layout to stdout without switching or opening the OSD.No default binding is added; users point whichever combo they already switch
with at it:
locked = trueis worth having here: the layout you type your lock-screen password in is the one place where being on the wrong one hurts most.Notes
mainkeyboard rather than the first entry inhyprctl devices— power buttons and other keymap-less inputs also sit inkeyboards, andallswitches every real keyboard anyway, so the main one speaks for the lot.hyprctlanswers the dispatch only after the switch lands, so the read that follows already sees the new keymap; no polling or delay is needed.keyboardicon; no shell changes.Tests
test/shell.d/keyboard-layout-test.shstubshyprctlandomarchy-osdand covers: the default action dispatchingswitchxkblayout all nextand showing the main keyboard's layout,prev,statusprinting without switching or opening the OSD, and an unknown action exiting non-zero. The fixture puts a keymap-less non-main "keyboard" first to pin the main-keyboard selection, and its keymap name carries a space and parentheses — the shape xkb names come in — to prove the name reaches the OSD intact.Verified on a running desktop: switching layouts shows the OSD with the layout name in the same spot the volume OSD uses.