feat: add keyboard layout indicator to bar - #130
Open
flathead wants to merge 3 commits into
Open
Conversation
Add a bar button that displays the active XKB layout code and allows switching between configured layouts. Includes a popup for direct layout selection and a toggle in Settings > Ambxst > Bar. New files: - modules/services/KeyboardLayoutService.qml - modules/bar/KeyboardLayoutIndicator.qml Modified files: - modules/bar/BarContent.qml - config/Config.qml - modules/widgets/dashboard/controls/ShellPanel.qml - modules/widgets/dashboard/controls/SettingsIndex.qml
flathead
force-pushed
the
feature/keyboard-layout-indicator
branch
from
March 25, 2026 23:20
f84029b to
6be9f4d
Compare
Owner
|
Nice, please add some screenshots. :) |
Author
Done |
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.
Adds a keyboard layout indicator button to the bar that shows the active XKB layout and lets users switch between configured layouts.
What was added
New files
modules/services/KeyboardLayoutService.qml-- singleton service that:hyprctl devices -jactivelayout>>events on the Hyprland socket for instant updateshyprctl devices -jevery 500ms as a fallback for key combos likegrp:alt_shift_togglethat do not emit socket events/usr/share/X11/xkb/rules/evdev.lst(no hardcoded language table)active_keymapvalues as layouts are activatedswitchLayout()(next),setLayout(index), andgetDisplayName(code)modules/bar/KeyboardLayoutIndicator.qml-- bar button that:BarPopupwith all available layouts as selectable buttonsprimaryvariantControlsButtonand other bar items (radius props, shadow, hover, animations)Modified files
config/Config.qml-- addedshowKeyboardLayout: trueto the bar JsonAdapter.modules/bar/BarContent.qml-- addedKeyboardLayoutIndicatorin both horizontal and vertical layouts, placed betweenControlsButtonandBatteryIndicator. Wrapped in aLoaderwith visibility condition:Config.bar.showKeyboardLayoutmust be true (default)KeyboardLayoutService.availableLayouts.length > 1(auto-hides when only one layout is configured)modules/widgets/dashboard/controls/ShellPanel.qml-- added a "Show Keyboard Layout" toggle in the Bar settings section, between "Enable Firefox Player" and the Auto-hide separator.modules/widgets/dashboard/controls/SettingsIndex.qml-- added a search index entry for "Keyboard Layout" with keywords: language, input, switch, layout, keyboard, locale, xkb.Behavior
Dependencies
ncat(fromnmap) for Hyprland socket listening/usr/share/X11/xkb/rules/evdev.lstfor layout name resolutionDemo
2026-04-01T21-19-29-730Z.mp4
Install as a mod
Requires the native manager from PR #230. Paste the package link into Settings → Mods → Package source:
The package needs
community.i18n(PR #134) for its Settings strings. The details pane marks that requirement as missing, disabled, or ready, and Install required mods fetches i18n, enables it first, and leaves this package for you to enable. The same steps from the CLI:The packaged version targets the current
devbase and includes the follow-up startup fix: it usesQuickshell.Hyprlandevents and a retrying device query, so it no longer needsncator a polling loop.Merge into Ambxst core
For core review, take this PR's branch: the feature as ordinary Ambxst source on
dev.The package patch is a separate artifact. It targets a tree that already carries the mod manager from PR #230 and the
community.i18npackage, because that is the only tree a mod can be installed on. To reproduce exactly what the manager composes:git remote add flathead https://github.com/flathead/Ambxst.git git fetch flathead feature/mod-manager git switch -c mods/keyboard-layout-indicator flathead/feature/mod-manager git apply --3way ambxst-mod-i18n/patches/feature.patch git apply --3way ambxst-mods/packages/keyboard-layout-indicator/patches/feature.patch go test ./... go vet ./...It adds
KeyboardLayoutService.qmlandKeyboardLayoutIndicator.qml, registers the indicator in both bar orientations, and adds its Config, Settings, and search-index entries. If i18n is not part of the core plan, this PR's branch carries the same feature with plain English strings. Either way the result is ordinary Ambxst source; the mod path adds no adapter that has to be rewritten for core.Package parity
The package in flathead/ambxst-mods and this branch now carry the same feature code:
KeyboardLayoutService.qmlandKeyboardLayoutIndicator.qmlare byte-identical, including the Hyprland-event rewrite.config/Config.qml,modules/bar/BarContent.qml,ShellPanel.qml, andSettingsIndex.qmldiffer only in their registration lines, because the package is generated on a tree that also carries the mod manager andcommunity.i18n.