From 44aeb5edc044dd6e8af54117c02181d9e9552413 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 8 Feb 2024 20:59:29 +0300 Subject: [PATCH 12/14] Backport bugfixes for keyboard layout: https://bugzilla.redhat.com/show_bug.cgi?id=1039185 https://bugzilla.redhat.com/show_bug.cgi?id=1912609 --- pyanaconda/keyboard.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py index 2c3226c..3ab47bc 100644 --- a/pyanaconda/keyboard.py +++ b/pyanaconda/keyboard.py @@ -171,8 +171,10 @@ def set_x_keyboard_defaults(localization_proxy, xkl_wrapper): # store it normalized new_layouts = [normalize_layout_variant(layouts[0])] if not langtable.supports_ascii(layouts[0]): - # does not support typing ASCII chars, append the default layout - new_layouts.append(DEFAULT_KEYBOARD) + # The default keymap setting should have "us" before the native layout + # which does not support ascii, + # refer: https://bugzilla.redhat.com/show_bug.cgi?id=1039185 + new_layouts.insert(0, DEFAULT_KEYBOARD) else: log.error("Failed to get layout for chosen locale '%s'", locale) new_layouts = [DEFAULT_KEYBOARD] @@ -181,6 +183,12 @@ def set_x_keyboard_defaults(localization_proxy, xkl_wrapper): if conf.system.can_configure_keyboard: xkl_wrapper.replace_layouts(new_layouts) + # the console layout configured should be "native" by default, + # setting that explicitly for non-ascii layouts where we prepend "us" + # refer: https://bugzilla.redhat.com/show_bug.cgi?id=1912609 + if len(new_layouts) >= 2 and not langtable.supports_ascii(new_layouts[1]): + localization_proxy.SetVirtualConsoleKeymap(new_layouts[1]) + if len(new_layouts) >= 2 and not localization_proxy.LayoutSwitchOptions: # initialize layout switching if needed localization_proxy.SetLayoutSwitchOptions(["grp:alt_shift_toggle"]) -- 2.39.3