]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-keymap-icon: Make Dvorak check case-insensitive
authorHans de Goede <hdegoede@redhat.com>
Mon, 10 Feb 2025 10:47:57 +0000 (11:47 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 10 Feb 2025 13:23:58 +0000 (14:23 +0100)
When using evdev support the XKB keymap name (with variant) for Dvorak
users will be e.g. "US (Dvorak)". The Dvorak layouts are not described
in /usr/share/X11/xkb/rules/evdev.xml, so these are not added to
ply-keymap-metadata.h / keymap-render.png .

For the console-keymap case dvorak is handled specially in:

keymap-render.py:normalize_keymaps()
ply-keymap-icon.c:ply_keymap_normalize_keymap()

mapping all keymap-names with a lowercase dvorak in there to "dvorak",
change this special handling to be case-insensitive so that it also works
for the xkb-keymap case.

Note the keymap-render.py change really is a no-op since keymap-render.py
only calls normalize_keymaps() on console-keymaps which are always
lower-case. normalize_keymaps() should still be updated though to keep
the 2 functions in sync.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2341810
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
scripts/keymap-render.py
src/libply-splash-graphics/ply-keymap-icon.c

index 2dc86575202af18f69a9b8313e1c4a46676699b9..20564f13299536c9b7156a190636a338abc42822 100755 (executable)
@@ -26,7 +26,7 @@ def get_keymaps():
                 # on machines returning "us" for both is not useful.
                 # Presumably users using dvorak now which variant they use
                 # so we just describe all dvorak layouts as "dvorak".
-                if "dvorak" in keymap:
+                if "dvorak" in keymap.lower():
                         return "dvorak"
 
                 # mac / sun keymaps are prefixes with mac / sun / sun[4-6]t
index b3dfabfb95916d60e09af6854c3d6f93b1bd79c7..26aabfdfc2e195e1cc073884d80476af8ea5e9bb 100644 (file)
@@ -61,7 +61,7 @@ ply_keymap_normalize_keymap (const char *keymap_with_variant)
         int i, length;
 
         /* Special case for dvorak layouts */
-        if (strstr (keymap_with_variant, "dvorak"))
+        if (strcasestr (keymap_with_variant, "dvorak"))
                 return strdup ("dvorak");
 
         /* Check for and skip sun / mac prefixes */