Restructured genkeymap/dump-keymaps.sh
This commit is contained in:
parent
2be49f3d73
commit
7301b505c9
@ -1,5 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Use evdev rules to obtain the mappings
|
||||
XKB_RULES=evdev
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# K B G E N
|
||||
#
|
||||
# Generates a keyboard mapping
|
||||
# $1 - LCID (See [MS-LCID])
|
||||
# $2 - Language tag (See [MS-LCID])
|
||||
# $3 - Current operating system
|
||||
# $4.. Arguments to setxkbmap to select the required keyboard
|
||||
# -----------------------------------------------------------------------------
|
||||
kbgen()
|
||||
{
|
||||
file=$(printf "../instfiles/km-%08s.toml" "$1" | tr ' ' '0')
|
||||
desc="$2"
|
||||
os="$3"
|
||||
shift 3
|
||||
setxkbmap "$@"
|
||||
./xrdp-genkeymap \
|
||||
-c "Description: $desc" \
|
||||
-c "Operating system: $os" \
|
||||
"$file"
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# M A I N
|
||||
# -----------------------------------------------------------------------------
|
||||
# Run the keymap extraction in a clean X session
|
||||
if [ "$1" != _IN_XVFB_SESSION_ ]; then
|
||||
# All commands available?
|
||||
@ -15,59 +43,57 @@ if [ "$1" != _IN_XVFB_SESSION_ ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
xvfb-run --auto-servernum --server-args="-noreset" $0 _IN_XVFB_SESSION_
|
||||
xvfb-run --auto-servernum --server-args="-noreset" "$0" _IN_XVFB_SESSION_
|
||||
exit $?
|
||||
fi
|
||||
|
||||
OLD_SETTINGS=$(setxkbmap -query -verbose 4 | sed "s/^\([a-z]\+\):\s*\(.*\)$/-\1 \2/;s/^-options/-option \"\" -option/;s/,/ -option /g" | xargs -d \\n)
|
||||
|
||||
# Use evdev rules for these mappings
|
||||
setxkbmap -rules evdev
|
||||
setxkbmap -rules "$XKB_RULES"
|
||||
|
||||
# English - US 'en-us' 0x00000409
|
||||
setxkbmap -model pc104 -layout us
|
||||
./xrdp-genkeymap ../instfiles/km-00000409.ini
|
||||
# Assign NumLock to mod2
|
||||
xmodmap -e "clear mod2" -e "add mod2 = Num_Lock"
|
||||
|
||||
# English - US 'dvorak' 0x00010409
|
||||
setxkbmap -model pc104 -layout dvorak
|
||||
./xrdp-genkeymap ../instfiles/km-00010409.ini
|
||||
# Find the operating system
|
||||
if command -v hostnamectl >/dev/null; then
|
||||
os=$(hostnamectl status | sed -ne 's/^i *Operating[^:]*: *//p')
|
||||
fi
|
||||
if [ -z "$os" ] && command -v lsb_release -v >/dev/null; then
|
||||
os=$(lsb_release --description --short)
|
||||
fi
|
||||
if [ -z "$os" ]; then
|
||||
os="Unknown"
|
||||
fi
|
||||
|
||||
# English - US 'dvp' 0x19360409
|
||||
setxkbmap -rules xfree86 -model pc105 -layout us -variant dvp -option "" -option compose:102 -option caps:shift -option numpad:sg -option numpad:shift3 -option keypad:hex -option keypad:atm -option kpdl:semi -option lv3:ralt_alt
|
||||
./xrdp-genkeymap ../instfiles/km-19360409.ini
|
||||
setxkbmap ${OLD_SETTINGS}
|
||||
|
||||
# English - UK 'en-GB' 0x00000809
|
||||
setxkbmap -model pc105 -layout gb
|
||||
./xrdp-genkeymap ../instfiles/km-00000809.ini
|
||||
|
||||
# German 'de' 0x00000407
|
||||
setxkbmap -model pc104 -layout de
|
||||
./xrdp-genkeymap ../instfiles/km-00000407.ini
|
||||
|
||||
# Italian 'it' 0x00000410
|
||||
setxkbmap -model pc104 -layout it
|
||||
./xrdp-genkeymap ../instfiles/km-00000410.ini
|
||||
|
||||
# Japanese 'jp' 0x00000411
|
||||
setxkbmap -model pc105 -layout jp -variant OADG109A
|
||||
./xrdp-genkeymap ../instfiles/km-00000411.ini
|
||||
|
||||
# Polish 'pl' 0x00000415
|
||||
setxkbmap -model pc104 -layout pl
|
||||
./xrdp-genkeymap ../instfiles/km-00000415.ini
|
||||
|
||||
# Russia 'ru' 0x00000419
|
||||
setxkbmap -model pc104 -layout ru
|
||||
./xrdp-genkeymap ../instfiles/km-00000419.ini
|
||||
|
||||
# Sweden 'se' 0x0000041d
|
||||
setxkbmap -model pc104 -layout se
|
||||
./xrdp-genkeymap ../instfiles/km-0000041d.ini
|
||||
|
||||
# Portuguese -PT 'pt-pt' 0x00000816
|
||||
setxkbmap -model pc104 -layout pt
|
||||
./xrdp-genkeymap ../instfiles/km-00000816.ini
|
||||
kbgen 0406 "da-DK" "$os" -model pc105 -layout dk
|
||||
kbgen 0407 "de-DE" "$os" -model pc104 -layout de
|
||||
kbgen 0409 "en-US" "$os" -model pc104 -layout us
|
||||
kbgen 10409 "en-US" "$os" -model pc104 -layout dvorak
|
||||
kbgen 040a "es-ES_tradnl" "$os" -model pc105 -layout es
|
||||
kbgen 040b "fi-FI" "$os" -model pc105 -layout 'fi'
|
||||
kbgen 040c "fr-FR" "$os" -model pc105 -layout fr
|
||||
kbgen 0410 "it-IT" "$os" -model pc104 -layout it
|
||||
kbgen 0411 "ja-JP" "$os" -model pc105 -layout jp -variant OADG109A
|
||||
kbgen 0412 "ko-KR" "$os" -model pc105 -layout kr
|
||||
kbgen 0414 "nb-NO" "$os" -model pc105 -layout no
|
||||
kbgen 0415 "pl-PL" "$os" -model pc104 -layout pl
|
||||
kbgen 0416 "pt-BR" "$os" -model pc105 -layout br
|
||||
kbgen 0419 "ru-RU" "$os" -model pc104 -layout ru
|
||||
kbgen 041d "sv-SE" "$os" -model pc104 -layout se
|
||||
kbgen 0807 "de-CH" "$os" -model pc105 -layout ch
|
||||
kbgen 0809 "en-GB" "$os" -model pc105 -layout gb
|
||||
kbgen 080a "es-MX" "$os" -model pc105 -layout latam
|
||||
kbgen 080c "fr-BE" "$os" -model pc105 -layout be -variant oss
|
||||
kbgen 0813 "nl-BE" "$os" -model pc105 -layout be
|
||||
kbgen 0816 "pt-PT" "$os" -model pc104 -layout pt
|
||||
kbgen 100c "fr-CH" "$os" -model pc105 -layout ch -variant fr
|
||||
|
||||
# Put keyboards which change options below the ones that don't to
|
||||
# prevent unexpected things happening to keypads, etc
|
||||
kbgen 19360409 "en-US" "$os" -model pc105 -layout us -variant dvp \
|
||||
-option "" -option compose:102 -option caps:shift -option numpad:sg \
|
||||
-option numpad:shift3 -option keypad:hex -option keypad:atm \
|
||||
-option kpdl:semi -option lv3:ralt_alt
|
||||
# set back to entry settings
|
||||
# shellcheck disable=SC2086
|
||||
setxkbmap ${OLD_SETTINGS}
|
||||
|
Loading…
Reference in New Issue
Block a user