Repository navigation
Apply the system keyboard layout to the SDDM greeter - #6896
Conversation
There was a problem hiding this comment.
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.
| -- 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 | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.XKBLAYOUTcan be present but empty (e.g.,XKBLAYOUT=or quoted empty). In Lua, an empty string is truthy, so this would setkb_layoutto"", 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 normalizeXKBVARIANTif 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]>
|
Reviewed and verified this end to end on a disposable VM, by pointing a real Hyprland instance at
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. 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 The sync test guards the list, not the logic. It asserts To be clear about scope, since the three issues read alike: this closes #6880 as filed. That reporter's |
|
Independently hit this on One thing worth reconsidering:
local kb_options = "compose:caps,shift:both_capslock_cancel"unconditionally — it isn't read from So a password containing a Compose-produced character is set under I'd agree That said, the trade-off cuts both ways, which is why I'm raising it rather than proposing a diff: adding I run |
|
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),
Why env-var variants of the workaround are no-ops (worth capturing in this thread): prefixing So an explicit Also confirming the upgrade-path note from #6880: the Quattro upgrade left 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. |
|
Re-reviewed at @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 @selfcrypto's Re-verified the lockout paths at this head, running a real Hyprland against
The I also drove the parser directly for a missing file, an absent 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 Waiting on the maintainer for the |
|
Checked again at Reproduction, on a disposable Omarchy VM. I started a real Hyprland with the greeter config and Tests, on the same VM. 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 Nothing was pushed. This is waiting on the maintainer, including the |
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