[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#920483: The keyboard layout displays “us” whatever the current layout until a key is pressed



Control: tags -1 patch

The attached patch fixed the issue for me for 0.18.0-1, but should
also work for 0.18.1-1.  It requires 2 additional dependencies on
x11-xkb-utils and xinput.

Regards,
Dennis.
Description: Set keymaps for virtual devices before login prompt.
 For this to work Depends: on x11-xkb-utils and xinput are needed.
Author: Dennis Filder <d.filder@web.de>
Bug-Debian: https://bugs.debian.org/920483
Last-Update: 2020-09-10
--- a/sddm-0.18.1/data/scripts/Xsetup
+++ b/sddm-0.18.1/data/scripts/Xsetup
@@ -1,3 +1,19 @@
 #!/bin/sh
 # Xsetup - run as root before the login dialog appears

+# Here we have to set the keymap of virtual keyboards to that of the
+# first-found physical one since the X server doesn't (#920483).
+#
+# This is also important for autologin setups in combination with
+# programs that take a snapshot of the current keymap to restore it
+# later (e.g. Orca).
+if [ -x /usr/bin/setxkbmap -a -x /usr/bin/xinput ]; then
+    PHYNAME="$(xinput --list --name-only | grep keyboard | grep -v '^Virtual core' | head -n 1)"
+    PHYID="$(xinput --list --id-only "${PHYNAME}" | head -n 1)"
+    VCKID="$(xinput --list --id-only "Virtual core keyboard" | head -n 1)"
+    XTESTID="$(xinput --list --id-only "Virtual core XTEST keyboard" | head -n 1)"
+    KEYMAP="$(setxkbmap -device "$PHYID" -query |grep ^layout|cut -d : -f 2|tr -d ' ')"
+    for id in "$VCKID" "$XTESTID"; do
+        setxkbmap -device "$id" -layout "$KEYMAP"
+    done
+fi

Reply to: