summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2016-01-05 09:36:14 +0100
committer Eric Hameleers <alien@slackware.com>2016-01-05 09:36:14 +0100
commitcea6043290fb411ad7c693007e4f62fc8687a02d (patch)
treeb29192a67506b32ace2cdbf5fe91b46be65390c1
parent65901f0dd71776c98e228e9df05e900e431224d2 (diff)
downloadliveslak-cea6043290fb411ad7c693007e4f62fc8687a02d.tar.gz
liveslak-cea6043290fb411ad7c693007e4f62fc8687a02d.tar.xz
Added support for separate configuration of X keyboard layout/variant.
New parameter for the boot commandline: xkb=[language],variant Examples: # Only specify a Xkbvariant, and inherit the console keyboard layout in X: kbd=nl xkb=,sundeadkeys # Define a 'french swiss' layout in X, independent of the console: xkb=ch,fr Two new keyboard/language choices have been added which use this functionality: - german swiss - french swiss (requested by Niki Kovacs). New: if a non-US keyboard layout is selected, the US layout will be added as a secondary layout. Toggling between the two layouts is possible using the Shift-LeftAlt key combo. Also new: the RightAlt key is now defined as the Compose Key in X. Meaning, the combo <RightAlt><"><e> will generate a 'ë character'.
-rw-r--r--languages28
-rwxr-xr-xliveinit33
-rwxr-xr-xmake_slackware_live.sh23
3 files changed, 57 insertions, 27 deletions
diff --git a/languages b/languages
index f03cabe..2baa558 100644
--- a/languages
+++ b/languages
@@ -1,13 +1,15 @@
-#code,name,kbd,tz,locale
-be,belgisch,be-latin1,Europe/Brussels,nl_BE.utf8
-br,brazil,br-abnt2,America/Sao_Paulo,pt_BR.utf8
-gb,british,uk,Etc/GMT,en_GB.utf8
-de,deutsch,de-latin1,Europe/Berlin,de_DE.utf8
-es,espanol,es,Europe/Madrid,es_ES.utf8
-fr,francais,fr,Europe/Paris,fr_FR.utf8
-it,italiano,it,Europe/Rome,it_IT.utf8
-ja,japanese,jp106,Asia/Tokyo,ja_JP.utf8
-nl,nederlands,nl,Europe/Amsterdam,nl_NL.utf8
-pt,portugues,pt-latin1,Europe/Lisbon,pt_PT.utf8
-ru,russian,ru_win,Europe/Moscow,ru_RU.utf8
-us,us american,us,US/Pacific,en_US.utf8
+#code:name:kbd:tz:locale:xkb
+be:belgisch:be-latin1:Europe/Brussels:nl_BE.utf8:
+br:brazil:br-abnt2:America/Sao_Paulo:pt_BR.utf8:
+gb:british:uk:Etc/GMT:en_GB.utf8:
+de:deutsch:de-latin1:Europe/Berlin:de_DE.utf8:
+de_ch:deutsch (schweiz):de-latin1:Europe/Zurich:de_CH.utf8:ch,
+es:espanol:es:Europe/Madrid:es_ES.utf8:
+fr:francais:fr-latin9:Europe/Paris:fr_FR.utf8:
+fr_ch:francais (suisse):fr-latin9:Europe/Zurich:fr_CH.utf8:ch,fr
+it:italiano:it:Europe/Rome:it_IT.utf8:
+ja:japanese:jp106:Asia/Tokyo:ja_JP.utf8:
+nl:nederlands:nl:Europe/Amsterdam:nl_NL.utf8:
+pt:portugues:pt-latin1:Europe/Lisbon:pt_PT.utf8:
+ru:russian:ru_win:Europe/Moscow:ru_RU.utf8:
+us:us american:us:US/Pacific:en_US.utf8:
diff --git a/liveinit b/liveinit
index 74e8cde..2193b33 100755
--- a/liveinit
+++ b/liveinit
@@ -124,6 +124,9 @@ for ARG in $(cat /proc/cmdline); do
waitforroot=*|rootdelay=*)
WAIT=$(echo $ARG | cut -f2 -d=)
;;
+ xkb=*)
+ XKB=$(echo $ARG | cut -f2 -d=)
+ ;;
esac
done
@@ -376,7 +379,7 @@ if [ "$RESCUE" = "" ]; then
if [ ! -z "$KEYMAP" ]; then
# Configure custom keyboard mapping in console and X:
- echo "${INITRD}: Switching live desktop to '$KEYMAP' keyboard"
+ echo "${INITRD}: Switching live console to '$KEYMAP' keyboard"
cat <<EOT > /mnt/overlay/etc/rc.d/rc.keymap
#!/bin/sh
# Load the keyboard map. More maps are in /usr/share/kbd/keymaps.
@@ -385,13 +388,37 @@ if [ -x /usr/bin/loadkeys ]; then
fi
EOT
chmod 755 /mnt/overlay/etc/rc.d/rc.keymap
- # Set a usable keyboard mapping in X.Org, derived from the console map:
+ fi
+ if [ ! -z "$KEYMAP" -o ! -z "$XKB" ]; then
+ # Set a keyboard mapping in X.Org, derived from the console map if needed:
+ # Variable XKB can be set to "XkbLayout,XkbVariant", like "xkb=ch,fr"
+ # You can set just the XkbVariant by adding something like "kbd=ch xkb=,fr"
+ XKBLAYOUT=$(echo $XKB |cut -d, -f1)
+ XKBVARIANT=$(echo $XKB |cut -d, -f2)
+ XKBOPTIONS="compose:ralt"
+ # Ensure that XKBLAYOUT gets a value; XKBVARIANT is allowed to be empty.
+ if [ -z "$XKBLAYOUT" ]; then
+ if [ -z "$KEYMAP" ]; then
+ XKBLAYOUT="us"
+ else
+ XKBLAYOUT="$(echo $KEYMAP |cut -c1-2)"
+ fi
+ fi
+ echo "${INITRD}: Switching live X desktop to '$XKBLAYOUT' keyboard"
+ # If the layout is not 'us' then add 'us' as a secondary nevertheless:
+ if [ "$XKBLAYOUT" != "us" ]; then
+ XKBLAYOUT="$XKBLAYOUT,us"
+ XKBVARIANT="$XKBVARIANT,"
+ XKBOPTIONS="grp:alt_shift_toggle,$XKBOPTIONS"
+ fi
mkdir -p /mnt/overlay/etc/X11/xorg.conf.d
cat <<EOT > /mnt/overlay/etc/X11/xorg.conf.d/30-keyboard.conf
Section "InputClass"
Identifier "keyboard-all"
Driver "evdev"
- Option "XkbLayout" "$(echo $KEYMAP |cut -c1-2)"
+ Option "XkbLayout" "$XKBLAYOUT"
+ Option "XkbVariant" "$XKBVARIANT"
+ Option "XkbOptions" "$XKBOPTIONS"
MatchIsKeyboard "on"
EndSection
EOT
diff --git a/make_slackware_live.sh b/make_slackware_live.sh
index ed60869..0200ceb 100755
--- a/make_slackware_live.sh
+++ b/make_slackware_live.sh
@@ -330,10 +330,10 @@ function gen_bootmenu() {
-e "s/@SL_VERSION@/$SL_VERSION/g" \
> ${MENUROOTDIR}/vesamenu.cfg
- for KBD in $(cat ${LIVE_TOOLDIR}/languages |grep -Ev "(^ *#|^$)" |cut -d, -f3)
+ for LANCOD in $(cat ${LIVE_TOOLDIR}/languages |grep -Ev "(^ *#|^$)" |cut -d: -f1)
do
- LANCOD=$(cat ${LIVE_TOOLDIR}/languages |grep ",$KBD," |cut -d, -f1)
- LANDSC=$(cat ${LIVE_TOOLDIR}/languages |grep ",$KBD," |cut -d, -f2)
+ LANDSC=$(cat ${LIVE_TOOLDIR}/languages |grep "^$LANCOD:" |cut -d: -f2)
+ KBD=$(cat ${LIVE_TOOLDIR}/languages |grep "^$LANCOD:" |cut -d: -f3)
# First, create keytab files if they are missing:
if [ ! -f ${MENUROOTDIR}/${KBD}.ktl ]; then
keytab-lilo $(find /usr/share/kbd/keymaps/i386 -name "us.map.gz") $(find /usr/share/kbd/keymaps/i386 -name "${KBD}.map.gz") > ${MENUROOTDIR}/${KBD}.ktl
@@ -362,17 +362,18 @@ EOL
> ${MENUROOTDIR}/menu_${LANCOD}.cfg
# Generate custom language selection submenu for selected keyboard:
- for SUBKBD in $(cat ${LIVE_TOOLDIR}/languages |grep -Ev "(^ *#|^$)" |cut -d, -f3) ; do
+ for SUBCOD in $(cat ${LIVE_TOOLDIR}/languages |grep -Ev "(^ *#|^$)" |cut -d: -f1) ; do
+ SUBKBD=$(cat ${LIVE_TOOLDIR}/languages |grep "^$SUBCOD:" |cut -d: -f3)
cat <<EOL >> ${MENUROOTDIR}/lang_${LANCOD}.cfg
-label $(cat ${LIVE_TOOLDIR}/languages |grep ",$SUBKBD," |cut -d, -f1)
- menu label $(cat ${LIVE_TOOLDIR}/languages |grep ",$SUBKBD," |cut -d, -f2)
+label $(cat ${LIVE_TOOLDIR}/languages |grep "^$SUBCOD:" |cut -d: -f1)
+ menu label $(cat ${LIVE_TOOLDIR}/languages |grep "^$SUBCOD:" |cut -d: -f2)
EOL
if [ "$SUBKBD" = "$KBD" ]; then
echo " menu default" >> ${MENUROOTDIR}/lang_${LANCOD}.cfg
fi
cat <<EOL >> ${MENUROOTDIR}/lang_${LANCOD}.cfg
kernel /boot/generic
- append initrd=/boot/initrd.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=$KBD tz=$(cat ${LIVE_TOOLDIR}/languages |grep ",$SUBKBD," |cut -d, -f4) locale=$(cat ${LIVE_TOOLDIR}/languages |grep ",$SUBKBD," |cut -d, -f5)
+ append initrd=/boot/initrd.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=$KBD tz=$(cat ${LIVE_TOOLDIR}/languages |grep "^$SUBCOD:" |cut -d: -f4) locale=$(cat ${LIVE_TOOLDIR}/languages |grep "^$SUBCOD:" |cut -d: -f5)
EOL
done
@@ -424,10 +425,10 @@ set default = $sl_lang
EOL
# Create the remainder of the selection menus:
- for KBD in $(cat languages |grep -Ev "(^ *#|^$)" |cut -d, -f3) ; do
- LANCOD=$(cat languages |grep ",$KBD," |cut -d, -f1)
- LANDSC=$(cat languages |grep ",$KBD," |cut -d, -f2)
- LANLOC=$(cat languages |grep ",$KBD," |cut -d, -f5)
+ for LANCOD in $(cat languages |grep -Ev "(^ *#|^$)" |cut -d: -f1) ; do
+ LANDSC=$(cat languages |grep "^$LANCOD:" |cut -d: -f2)
+ KBD=$(cat languages |grep "^$LANCOD:" |cut -d: -f3)
+ LANLOC=$(cat languages |grep "^$LANCOD:" |cut -d: -f5)
# Add this entry to the keyboard selection menu:
cat <<EOL >> ${GRUBDIR}/kbd.cfg
menuentry "${LANDSC}" {