ply-keymap-icon: Make Dvorak check case-insensitive

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>
This commit is contained in:
Hans de Goede 2025-02-10 11:47:57 +01:00
parent a0e8b6cf50
commit f443234585
2 changed files with 2 additions and 2 deletions

View file

@ -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

View 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 */