-
Notifications
You must be signed in to change notification settings - Fork 0
/
10-set-layout-switcher-kbd-combination.sh
executable file
·52 lines (45 loc) · 1.34 KB
/
10-set-layout-switcher-kbd-combination.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
LANG_LINE="ru ua bg in ara gur mkd dev kz(kazrus) kz am ge by"
if [ -f /etc/sysconfig/keyboard ]; then
. /etc/sysconfig/keyboard
/sbin/pidof gdm-binary > /dev/null 2>&1
if [ $? -eq 0 ]; then
GDM_CURRENT_LANG=$(setxkbmap -print | grep "xkb_symbols" | awk -F+ '{ print $2 }')
if [ "$GDM_CURRENT_LANG" == "us" ]; then
echo $LAYOUT | grep "$GDM_CURRENT_LANG" > /dev/null 2>&1
if [ $? -eq 0 ]; then
if [ -z $OPTIONS ]; then
setxkbmap -layout $LAYOUT
else
setxkbmap -layout $LAYOUT -option $OPTIONS
fi
else
if [ -z $OPTIONS ]; then
setxkbmap -layout $GDM_CURRENT_LANG
else
setxkbmap -layout $GDM_CURRENT_LANG -option $OPTIONS
fi
fi
else
echo $LANG_LINE | grep "$GDM_CURRENT_LANG" > /dev/null 2>&1
if [ $? -eq 0 ]; then
if [ -z $OPTIONS ]; then
OPTIONS="grp:alt_shift_toggle,grp_led:scroll"
fi
setxkbmap -layout us,$GDM_CURRENT_LANG -option $OPTIONS
else
if [ -z $OPTIONS ]; then
setxkbmap -layout $GDM_CURRENT_LANG
else
setxkbmap -layout $GDM_CURRENT_LANG -option $OPTIONS
fi
fi
fi
else
if [ -z $OPTIONS ]; then
setxkbmap -layout $LAYOUT
else
setxkbmap -layout $LAYOUT -option $OPTIONS
fi
fi
fi