From 8326025c27118f92ed63c74f81cdd7e71e4260ca Mon Sep 17 00:00:00 2001 From: Daniele Debernardi Date: Tue, 19 Nov 2019 00:45:10 +0100 Subject: [PATCH] install: setup xorg keymap (!1833) With the nokia N900 the user can choose between different keyboard layouts and during the install the setup-keymap installs the choosen layout. This only changes the keyboard layout of the console, while installing a UI using xorg, the layout was hardcoded to "us". With a simple check for the existence of an xorg config containing XkbLayout, this will run sed to replace the default with the layout chosen by the user. Tested with a clean install of the nokia N900 with the xfce4 UI. --- pmb/install/_install.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pmb/install/_install.py b/pmb/install/_install.py index 107be936..1b067747 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -260,6 +260,17 @@ def setup_keymap(args): layout, variant = args.keymap.split("/") pmb.chroot.root(args, ["setup-keymap", layout, variant], suffix, output="interactive") + + # Check xorg config + config = pmb.chroot.root(args, ["grep", "-rl", "XkbLayout", "/etc/X11/xorg.conf.d/"], + suffix, check=False, output_return=True) + if config: + # Multiple files can contain the keyboard layout, take last + config = config.splitlines()[-1] + old_text = "Option *\\\"XkbLayout\\\" *\\\".*\\\"" + new_text = "Option \\\"XkbLayout\\\" \\\"" + layout + "\\\"" + pmb.chroot.root(args, ["sed", "-i", "s/" + old_text + "/" + new_text + "/", config], + suffix) else: logging.info("NOTE: No valid keymap specified for device")