Skip to content

Derive the Hyprland keyboard layout from the console keymap - #8685

Closed
ForkIt369 wants to merge 1 commit into
omacom:quattrofrom
ForkIt369:fix/restore-keymap-layout
Closed

ForkIt369 wants to merge 1 commit into
omacom:quattrofrom
ForkIt369:fix/restore-keymap-layout

Conversation

@ForkIt369

Copy link
Copy Markdown

Fresh Quattro installs persist the selected keyboard with systemd-firstboot --keymap, which writes KEYMAP to /etc/vconsole.conf. The Hyprland input defaults only read XKBLAYOUT, so selections such as Colemak silently fell back to the US layout in the session.

When XKBLAYOUT is absent or empty, derive the XKB layout and variant from KEYMAP through /usr/share/systemd/kbd-model-map. Explicit XKB settings still take precedence, and resolved non-Latin layouts continue through the existing US-prefix handling.

Nine keymaps offered by the installer have no entry in the systemd map, so a small fallback table covers those choices. The test suite also keeps the installer list synchronized with either the systemd map or that table.

One existing mismatch is made explicit in the code: the installer labels the azerty console keymap as Azerbaijani, while that console keymap is historically French AZERTY. The fallback preserves the installer intent by resolving it to the az XKB layout; the installer label/keymap pairing can be corrected separately.

Addresses #7049 and #6878 without closing them: this fixes the Hyprland session layout, while the fcitx5 and installer-persistence aspects remain outside this change.

Tested:

  • bash test/shell.d/hyprland-keyboard-layout-test.sh (23 checks pass)
  • ./test/cli (passes)
  • Patched module against this affected host with KEYMAP=colemak resolves layout=us and variant=colemak
  • ./test/shell: the keyboard test passes; five unrelated files also fail on a clean upstream checkout because local package fixtures or external access are unavailable. A transient screenshot sanity failure passed on immediate rerun.

Copilot AI balanced review requested due to automatic review settings August 27, 2026 23:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Derives Hyprland keyboard layouts from console KEYMAP values when explicit XKB settings are absent.

Changes:

  • Resolves keymaps through systemd’s map with installer-specific fallbacks.
  • Preserves explicit XKB precedence and non-Latin handling.
  • Adds resolution and installer synchronization tests.

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 2 out of 2 changed files in this pull request and generated no comments.

File Description
default/hypr/input.lua Adds console-to-XKB keymap resolution.
test/shell.d/hyprland-keyboard-layout-test.sh Covers resolution, fallbacks, precedence, and installer mappings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ralfboltshauser

Copy link
Copy Markdown

keyboard layouts like German Switzerland is also not persisted. This would fix it!

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 1b736a5. I read it and did not run it: two other open pull requests fix the same bug, and I compared the three before spending a worker on any of them.

All three fix the gap behind #7049, #6878 and #9442. Nine of the installer's console keymaps have no row in systemd's kbd-model-map, so /etc/vconsole.conf ends up with only KEYMAP and Hyprland falls back to us.

There is also a defect in this pull request's fallback table, in default/hypr/input.lua. Three entries name an XKB layout that types differently from the console keymap the user picked. Setup asks for the password on that console keymap, so the password typed there can stop working at login and on the lock screen:

#11418 maps these three to cz/qwerty, bg/phonetic and fr, which match what the console types.

On that reading, #11418 is the better candidate because it fixes the cause for every reader. This pull request should not be brought forward alongside it. The choice is the maintainer's, so this waits on them. #11056, which points six installer rows at keymaps systemd can map, complements any of the three rather than competing with them.

This was one reviewer's reading (Claude Opus 5.5). No second opinion ran: the configured reviewer (Codex Medium) answers, but omabot's daily review budget was used up before this comparison. Nothing was run on a worker.

@dhh

dhh commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Superseded by #20187 and omacom/omarchy-iso#528, which write the missing XKB settings into /etc/vconsole.conf at install time from a single table shared through setup-form.sh (existing KEYMAP-only upgrades are tracked separately in #6878). Thanks for the PR!

@dhh dhh closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants