From 2b7133e2802f4148d5bfc8aeecb5ac8052c27fdb Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Wed, 20 Jul 2016 17:37:13 +0200 Subject: liveinit: use AltGr as Compose Key only for US keyboard layouts. --- liveinit | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/liveinit b/liveinit index 8f4fa79..bde1cb4 100755 --- a/liveinit +++ b/liveinit @@ -805,6 +805,9 @@ EOT # Note that the XkbOptions can be several comma-separated values. # The XkbLayout and XkbVariant values must not contain commas. # You can set just the XkbVariant by adding something like "kbd=ch xkb=,fr" + + # Catch a missing comma in the "$XKB" string value which messes with 'cut': + XKB="$XKB," XKBLAYOUT=$(echo $XKB |cut -d, -f1) XKBVARIANT=$(echo $XKB |cut -d, -f2) XKBOPTIONS=$(echo $XKB |cut -d, -f3-) @@ -831,27 +834,37 @@ EOT if [ -z "$XKBOPTIONS" ]; then # If the user did not specify any X keyboard options then we will # determine a set of sane defaults: - if [ "$XKBLAYOUT" = "de" ]; then - # Germans use the AltGr key, so Scroll Lock will be their Compose Key: - XKBOPTIONS="compose:sclk" + if [ "$XKBLAYOUT" != "us" ]; then + # User should be able to switch between layouts (Alt-Shift toggles). + # Also, many languages use the AltGr key, so we will use Scroll Lock + # as the Compose Key: + XKBOPTIONS="grp:alt_shift_toggle,grp_led:scroll,compose:sclk" else - # Rest of the world use the Right Alt (AltGr): + # For US keyboard we use the Right Alt (AltGr): XKBOPTIONS="compose:ralt" fi - if [ "$XKBLAYOUT" != "us" ]; then - # User should be able to switch between layouts: - XKBOPTIONS="grp:alt_shift_toggle,grp_led:scroll,$XKBOPTIONS" - fi fi mkdir -p /mnt/overlay/etc/X11/xorg.conf.d - cat < /mnt/overlay/etc/X11/xorg.conf.d/30-keyboard.conf + echo > /mnt/overlay/etc/X11/xorg.conf.d/30-keyboard.conf + cat <> /mnt/overlay/etc/X11/xorg.conf.d/30-keyboard.conf Section "InputClass" Identifier "keyboard-all" + MatchIsKeyboard "on" + MatchDevicePath "/dev/input/event*" Driver "evdev" Option "XkbLayout" "$XKBLAYOUT" - Option "XkbVariant" "$XKBVARIANT" +EOT + if [ -z "$XKBVARIANT" ]; then + cat <> /mnt/overlay/etc/X11/xorg.conf.d/30-keyboard.conf + #Option "XkbVariant" "$XKBVARIANT" +EOT + else + cat <> /mnt/overlay/etc/X11/xorg.conf.d/30-keyboard.conf + Option "XkbVariant" "$XKBVARIANT" +EOT + fi + cat <> /mnt/overlay/etc/X11/xorg.conf.d/30-keyboard.conf Option "XkbOptions" "$XKBOPTIONS" - MatchIsKeyboard "on" EndSection EOT -- cgit v1.2.3