Skip to content

Apply the system keyboard layout to the SDDM greeter - #6896

Merged
dhh merged 3 commits into
omacom:quattrofrom
g-desoutter:fix-sddm-greeter-keyboard-layout
Oct 4, 2026
Merged

dhh merged 3 commits into
omacom:quattrofrom
g-desoutter:fix-sddm-greeter-keyboard-layout

Conversation

@g-desoutter

Copy link
Copy Markdown
Contributor

The SDDM greeter starts its own Hyprland instance via CompositorCommand, and
default/sddm/hyprland.lua declared no input block — so the greeter always fell
back to Hyprland's built-in "us" default, regardless of the system layout. On a
FR/AZERTY machine the password field is QWERTY and the password cannot be typed.

This resolves kb_layout / kb_variant from /etc/vconsole.conf, mirroring what
default/hypr/input.lua already does for the session, and prepends "us" for
non-Latin layouts so the greeter always stays typeable. The greeter gets no
compose or capslock options: those are session comfort settings, unrelated to
typing a password.

The resolution logic is duplicated rather than shared: the greeter runs as the
sddm user and starts from this file directly, so it never goes through
default/hypr/bootstrap.lua, which builds package.path from $HOME. The added test
asserts the greeter's non-Latin list stays in sync with the initramfs hook, so
the duplication can't drift silently.

Verified on Omarchy 4.0.0 with XKBLAYOUT=fr: the greeter is AZERTY with this
change and QWERTY without it.

Fixes #6880

Copilot AI balanced review requested due to automatic review settings August 14, 2026 20:22

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds keyboard layout resolution support for the SDDM Hyprland greeter and extends the shell test coverage to validate greeter behavior and keep non‑Latin layout lists in sync.

Changes:

  • Refactors the test harness to resolve input from different Lua entrypoints (session vs greeter) and adds greeter-specific assertions.
  • Introduces vconsole.conf parsing and non‑Latin layout handling directly in default/sddm/hyprland.lua.
  • Extends sync checks to ensure the greeter’s non‑Latin list matches the initramfs hook list.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/shell.d/hyprland-keyboard-layout-test.sh Adds module-selectable resolution helpers and new greeter layout assertions + list sync checks.
default/sddm/hyprland.lua Implements greeter-side vconsole parsing and layout/options derivation (including non‑Latin prepend behavior).

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

Comment thread default/sddm/hyprland.lua
Comment on lines +4 to +45
-- The layout resolution below is deliberately duplicated from
-- default/hypr/input.lua. The greeter runs as the sddm user and starts from
-- this file directly, so it never goes through default/hypr/bootstrap.lua --
-- which builds package.path from $HOME and therefore can't set up require()
-- here. Keep the two in sync.
local function read_vconsole()
local values = {}
local file = io.open("/etc/vconsole.conf", "r")
if not file then
return values
end
for line in file:lines() do
local key, value = line:match("^%s*([%w_]+)%s*=%s*(.-)%s*$")
if key and value then
value = value:gsub("%s+#.*$", "")
value = value:gsub('^"(.*)"$', "%1")
value = value:gsub("^'(.*)'$", "%1")
values[key] = value
end
end
file:close()
return values
end

-- Layouts that can't type Latin letters. Keep in sync with the list in
-- etc/mkinitcpio.conf.d/omarchy_hooks.conf and default/hypr/input.lua.
local non_latin_layouts =
" af am ara bd bg by et ge gr il in iq ir kg kh kz la lk mk mm mn mv np rs ru sy th tj ua "

local vconsole = read_vconsole()
local kb_layout = vconsole.XKBLAYOUT or "us"
local kb_variant = vconsole.XKBVARIANT or ""
local kb_options = ""

-- A greeter that can't type Latin letters can't take a password either, so a
-- non-Latin layout gets us in front, reachable back with Left Alt + Right Alt.
if non_latin_layouts:find(" " .. kb_layout:match("^[^,]*") .. " ", 1, true) then
kb_layout = "us," .. kb_layout
kb_variant = "," .. kb_variant
kb_options = "grp:alts_toggle"
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I considered a shared module, but the greeter is the one place where a failed
require() means nobody can log in at all, so I went for the safer option.

Deriving the path from debug.getinfo only yields /usr/share/sddm, which gets us
no closer to the Omarchy Lua tree. The alternative is hardcoding
/usr/share/omarchy, which breaks the $OMARCHY_PATH linked-checkout setup that
env-bootstrap and dev-env-path-test.sh rely on — the greeter would silently
load the packaged config instead of the checkout being worked on.

So the duplication here is deliberate, and CI-enforced: the sync test fails if
the non-Latin list diverges from omarchy_hooks.conf. Happy to switch to a
shared module if there's an existing pattern for loading Omarchy Lua outside a
user session that I've missed.

Copilot AI review requested due to automatic review settings August 14, 2026 20:31

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

default/sddm/hyprland.lua:35

  • vconsole.XKBLAYOUT can be present but empty (e.g., XKBLAYOUT= or quoted empty). In Lua, an empty string is truthy, so this would set kb_layout to "", which can incorrectly trigger the non-Latin prepend logic and produce invalid layouts (e.g., us,). Consider normalizing empty/whitespace-only values to nil/default (e.g., treat "" as missing and fall back to "us"), and similarly normalize XKBVARIANT if needed.
local vconsole = read_vconsole()
local kb_layout = vconsole.XKBLAYOUT or "us"
local kb_variant = vconsole.XKBVARIANT or ""
local kb_options = ""

default/sddm/hyprland.lua:31

  • The non-Latin layout list is now duplicated across at least three places (hook config, session input.lua, and this greeter config). Even with tests, this increases ongoing maintenance cost and makes drift more likely when updates happen outside the test environment. A more maintainable approach would be to centralize this list in a small shared Lua module (and/or single source of truth file) that both the session and greeter can load, reducing the required syncing to one place.
-- Layouts that can't type Latin letters. Keep in sync with the list in
-- etc/mkinitcpio.conf.d/omarchy_hooks.conf and default/hypr/input.lua.
local non_latin_layouts =
  " af am ara bd bg by et ge gr il in iq ir kg kh kz la lk mk mm mn mv np rs ru sy th tj ua "

The stub only returned nil for an unset OMARCHY_VCONSOLE, but bash passes it
through as "", so both fallback cases were reading an empty temp file instead
of exercising the failed open.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 15, 2026 10:15

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified this end to end on a disposable VM, by pointing a real Hyprland instance at default/sddm/hyprland.lua with a synthetic /etc/vconsole.conf and reading back hyprctl devices:

/etc/vconsole.conf greeter keyboard
XKBLAYOUT=fr l "fr", active keymap French
XKBLAYOUT=ru l "us,ru", o "grp:alts_toggle", active layout index 0 (English (US))
XKBLAYOUT=fr-latin1 (invalid XKB name) l "us" — Hyprland starts normally and degrades to US
KEYMAP=fr only, no XKBLAYOUT l "us"

So the fix works, and the worst case is a silent US fallback rather than a greeter that fails to start — worth knowing, since a compositor that refuses to start here would lock the user out of the machine. ./test/shell.d/hyprland-keyboard-layout-test.sh is green (11/11) on that VM. I also probed the parser directly with an empty XKBLAYOUT=, a quoted value, a # comment suffix, CRLF line endings and XKBLAYOUT=ru,us — none raise a Lua error, which matters more here than elsewhere for the same reason.

Two things worth saying, neither of which I've changed:

The greeter still can't type a compose-key password. The description says the compose and capslock options are "session comfort settings, unrelated to typing a password", but compose:caps is what makes Caps Lock the Compose key, and a password containing a character the user composes (Compose + e + ' → é on a layout where it isn't a direct key) is typeable in their session and not at the greeter. That's unchanged by this PR rather than caused by it, and dropping shift:both_capslock_cancel is clearly right — the SDDM theme has no Caps Lock indicator, so Caps Lock should stay Caps Lock. But since the greeter now follows the layout, the remaining gap gets more surprising, not less. Your call, and the maintainer's.

The sync test guards the list, not the logic. It asserts non_latin_layouts matches omarchy_hooks.conf, which is real coverage. What it doesn't guard is read_vconsole and the layout resolution itself — the part most likely to change next. #6878 and #7049 are both asking for exactly that change: on those machines /etc/vconsole.conf carries only KEYMAP= (fr-latin1, no-latin1), so XKBLAYOUT is absent and the session falls back to us. If default/hypr/input.lua grows a KEYMAP-derived fallback to fix them, this greeter copy will silently not get it and the greeter will start disagreeing with the session again — with nothing failing to say so.

To be clear about scope, since the three issues read alike: this closes #6880 as filed. That reporter's localectl status shows X11 Layout: fr and their session is already fr, so their XKBLAYOUT is set and the greeter was the only thing left behind. It doesn't reach #6878 or #7049, but it doesn't need to — on those machines the session is us too, so the greeter already agrees with it. The bug there is upstream of this file.

@selfcrypto

Copy link
Copy Markdown
Contributor

Independently hit this on es/Omarchy 4.0.0 and ended up at essentially the same patch, so the read_vconsole() + non-Latin prepend approach here matches what I found working.

One thing worth reconsidering: kb_options = "".

default/hypr/input.lua:37 hardcodes

local kb_options = "compose:caps,shift:both_capslock_cancel"

unconditionally — it isn't read from vconsole.conf — so every Omarchy session has Compose on Caps Lock:

$ hyprctl getoption input:kb_options
str: compose:caps,shift:both_capslock_cancel

So a password containing a Compose-produced character is set under compose:caps (via passwd in a session terminal) and then can't be reproduced at the greeter. That's the same failure this PR fixes, just a narrower slice of it.

I'd agree shift:both_capslock_cancel is a comfort setting and doesn't belong here, but compose:caps changes which characters are typeable at all, which seems in scope.

That said, the trade-off cuts both ways, which is why I'm raising it rather than proposing a diff: adding compose:caps means Caps Lock stops acting as Caps Lock at the greeter, so a password whose uppercase is entered by toggling Caps Lock — plausible if it was set at a TTY or during install, where Compose isn't active — would break instead. Either way one narrow case stays broken; matching the session at least matches where passwords usually get set.

I run compose:caps in a local override on this machine and it's been fine, but that's a single data point.

@JoseEchave

Copy link
Copy Markdown

Another data point confirming both the bug and this fix approach — plus a finding on why the env-var workaround doesn't work, which I think strengthens the case for merging this exact PR.

Setup: Omarchy 4.0.0-1 (upgraded 3.8.x → 4.0.0 in August), fi layout, password containing @.

  • /etc/vconsole.conf: XKBLAYOUT=fi; localectl: X11 Layout fi
  • Session: hyprctl getoption input:kb_layout → fi — correct
  • Greeter: US. @ is AltGr+2 on fi, which types nothing on us, so PAM rejects with plain Authentication failure. Retyping the password as US QWERTY (Shift+2 for @) logs in — same experience as @sir-ragna on SDDM greeter always uses US keyboard layout, ignoring the system layout #6880.
  • With autologin enabled the greeter is skipped at boot and only shows up on logout or a crash, so the machine feels fine until exactly the wrong moment — which also explains why this survives casual testing.

Why env-var variants of the workaround are no-ops (worth capturing in this thread): prefixing CompositorCommand with XKB_DEFAULT_LAYOUT=fi, or setting SDDM's GreeterEnvironment (as @jonasyr tried on #5986), does nothing on Hyprland 0.56.2. InputManager::setupKeyboard passes Config::mgr()->getDeviceString(devname, "kb_layout", "input:kb_layout") straight into IKeyboard::setKeymap(), and with no config set that getter returns the built-in default us — not an empty string — so libxkbcommon's XKB_DEFAULT_* fallback is never reached. Verified headless:

$ XKB_DEFAULT_LAYOUT=fi WLR_BACKENDS=headless Hyprland --config /usr/share/sddm/hyprland.lua
$ hyprctl -i <sig> getoption input:kb_layout
str: us
set: false

So an explicit input { kb_layout } in the greeter's own config — as this PR does — is the only thing that actually moves the needle. I confirmed that path too: a wrapper config loading the same misc/animations plus kb_layout = "fi" gives str: fi, set: true. That's what I'm running locally (user-owned /etc/sddm/hyprland-kbd.lua + a drop-in in /etc/sddm.conf.d/) until this merges.

Also confirming the upgrade-path note from #6880: the Quattro upgrade left 10-wayland.conf.pacnew sitting next to the old 10-wayland.conf, and since SDDM's conf.d reader doesn't filter on extension, both were parsed — two different CompositorCommand values depending on alphabetical order.

For any non-US user whose password contains a layout-sensitive character, this is effectively a lockout unless they happen to know the US positions of their password characters cold. Would love to see this in a 4.0.x release.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at f2d6527a — the head hasn't moved, so this is only about the two comments since. Verdict unchanged: good to merge as it stands, nothing pushed.

@JoseEchave's mechanism claim holds, with one correction to the call chain. Checked two ways against Hyprland 0.56.2, on a disposable VM. Empirically, with the pre-PR greeter config (no input block at all) and XKB_DEFAULT_LAYOUT=fi in the environment: hyprctl getoption input:kb_layout → str: us, set: false, and the keyboard's active keymap is English (US). The same config from this PR with XKBLAYOUT=fi in /etc/vconsole.conf: str: fi, set: true, active keymap Finnish. And in the binary, Config::Values::getConfigValues() constructs the input:kb_layout config value with the literal default "us" — the CStringValue constructor call at 0x48acb3 takes "input:kb_layout" as its name and "us" as its default — which is exactly what set: false is reporting. Since the string reaching libxkbcommon is non-empty, xkb_keymap_new_from_names never gets to its XKB_DEFAULT_* fallback; that path fires only on a null or empty layout. The correction: the call is CInputManager::setupKeyboard → CInputManager::applyConfigToKeyboard → getDeviceString(...) → IKeyboard::setKeymap(), not setupKeyboard doing it directly. It doesn't change the conclusion. What I did not test is whether SDDM's GreeterEnvironment even delivers the variable — it doesn't matter, because a delivered variable still loses to a non-empty config default.

@selfcrypto's kb_options question — the mechanics, so the trade-off is stated accurately. From xkbcli compile-keymap on the same VM, compose:caps changes exactly one key and one modifier map: key <CAPS> goes from [ Caps_Lock ] to [ Multi_key, Multi_key ], and modifier_map Lock { <CAPS> } disappears. Nothing else in the keymap moves. So two things follow. It does not change any directly-typeable character — it only adds Compose sequences, and Shift still produces uppercase. And the counter-case is stronger than described: with compose:caps alone no key maps to Lock at all, so it isn't that Caps Lock stops acting as Caps Lock, it's that a Caps Lock cannot be produced by any key. That inverts the split: compose:caps,shift:both_capslock_cancel compiles to modifier_map Lock { <LFSH> }, so paired with compose:caps the shift option isn't comfort — it is the only route back to a Caps Lock, and compose:caps on its own is the one combination in which a Caps-Lock-typed password becomes un-enterable. There's also a third option neither of us named: compose:caps-altgr keeps <CAPS> as Caps_Lock on levels 1–2 with Multi_key on 3–4 and retains modifier_map Lock { <CAPS> } — though it needs a level-3 modifier, which plain us doesn't have, and it would make the greeter differ from the session in a different direction. One thing worth establishing before any of this is decided: composing is done client-side by the toolkit, not by the compositor, so handing the greeter compose:caps does not by itself mean the SDDM Qt greeter will compose sequences. I didn't test that. The theme has no Caps Lock indicator and no compose handling either (grep -ri caps default/sddm/omarchy/ is empty). Still the maintainer's call, and I'm not proposing a diff for it.

Re-verified the lockout paths at this head, running a real Hyprland against default/sddm/hyprland.lua and reading back hyprctl devices. New rows beyond what I checked last time:

/etc/vconsole.conf greeter keyboard
XKBLAYOUT=ru + XKBVARIANT=phonetic l "us,ru", v ",phonetic", o "grp:alts_toggle", active layout index 0, English (US)
XKBLAYOUT=us,fi l "us,fi", index 0 English (US)
XKBLAYOUT= (empty value) l "" → English (US), compositor healthy

The fi, missing-file and invalid-name (fr-latin1 → l "us") rows reproduce what I got before. The ru row is the one that matters for the prepend: US is active, not merely available, so the username and password are typeable on a non-Latin system.

I also drove the parser directly for a missing file, an absent XKBLAYOUT, an empty XKBLAYOUT=, us,fi, ru,us with XKBVARIANT=phonetic, ru with no variant, quoted values, a trailing # comment, CRLF endings, blank and junk lines, and a layout name containing % and .. None raises a Lua error — the one failure mode that would mean no greeter at all rather than a wrong one. The variant stays aligned with the layout it belongs to across the prepend (ru + phonetic → us,ru / ,phonetic), and find(..., 1, true) is a plain find, so a pattern metacharacter in a layout name can't misfire. ./test/shell.d/hyprland-keyboard-layout-test.sh is green, 11/11, and the branch still merges cleanly into current quattro (43bfe9b9), which hasn't touched any of these files.

One correlation worth recording: #5986 was closed in July as fixed or superseded by Quattro, and @JoseEchave's 4.0.0-1 report shows it wasn't — which is why the same bug came back as #6880 and got two independent re-discoveries in this thread.

Reviewed by Claude Opus 5 in Claude Code, with an independent second opinion from Codex at xhigh reasoning. Codex reached the "us" default from the binary as well — its independence isn't currently guaranteed, since it can read this session's own transcript — but it contributed the applyConfigToKeyboard step in the call chain and the compose:caps-altgr option, neither of which I had. It found no defect.

Waiting on the maintainer for the compose:caps scope question, and on nothing else.

@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Checked again at f2d6527a, this time merged into current quattro (3faafba2), which it merges into cleanly. It still fixes the bug, and it's now labelled verified and ready.

Reproduction, on a disposable Omarchy VM. I started a real Hyprland with the greeter config and XKBLAYOUT=fr in /etc/vconsole.conf, then read hyprctl devices. With quattro's default/sddm/hyprland.lua the keyboard is l "us", English (US). With this branch's file it is l "fr", French. Putting quattro's file back brings back US. With XKBLAYOUT=ru and XKBVARIANT=phonetic it comes up as l "us,ru", v ",phonetic", o "grp:alts_toggle", with US active. With an empty vconsole.conf it falls back to us.

Tests, on the same VM. test/shell.d/hyprland-keyboard-layout-test.sh passes, 11/11. ./test/cli fails only on two vscode-theme assertions (vscode generated theme references current theme file and vscode generated theme clears obsolete extension marker). Both fail the same way on plain quattro, and everything else in the suite passes on both trees.

Second opinion: Codex at medium effort. It found no way for the new code to stop the greeter from starting, found the change proportionate, and found the copied resolver matches default/hypr/input.lua apart from the deliberate kb_options difference. Where that agrees with me, independence isn't guaranteed. It also noted one thing I hadn't considered. A system whose XKBLAYOUT puts a Latin layout first, such as us,ru, gets no layout toggle at the greeter, so a password typed in the second layout still can't be entered there. The session resolver on quattro behaves the same way and this PR doesn't change that case, so I'm noting it here rather than pushing a change.

Nothing was pushed. This is waiting on the maintainer, including the compose:caps question from the earlier review.

@dhh
dhh merged commit 75b327b into omacom:quattro Oct 4, 2026
@emirb emirb added this to the 4.5 milestone Oct 17, 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 ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDDM greeter always uses US keyboard layout, ignoring the system layout

7 participants