-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
install_layout_select.sh
50 lines (42 loc) · 1.61 KB
/
install_layout_select.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
#!/bin/bash
source non_sudo_check.sh
DEVICE_ID=$(cat /proc/bus/input/devices | grep ".*Touchpad\"$" | sort | cut -f 3 -d" " | cut -f 2 -d ":" | head -1)
if [ -z "$LAYOUT_NAME" ]; then
echo
echo "Is recommended layout wrong please? Please create an issue (https://github.com/asus-linux-drivers/asus-numberpad-driver/issues)."
echo
echo "NumberPad layout"
echo
echo "Are predefined 2 variants of numberpad layouts for each laptop:"
echo " - Standard is recommended to use, the keys except percent and hash tag are send directly but layout is not resistant to overbinding these keys to something else and that is reason why exist second version"
echo " - Unicode send keys like unicode chars except backspace and enter using shortcut Ctrl+Shift+U+<sequence of number keys>."
echo
echo "Select layout:"
echo
PS3="Please enter your choice "
OPTIONS=($(ls layouts) "Quit")
select SELECTED_OPT in "${OPTIONS[@]}"; do
if [ "$SELECTED_OPT" = "Quit" ]; then
exit 0
fi
for OPTION in $(ls layouts); do
if [ "$OPTION" = "$SELECTED_OPT" ]; then
LAYOUT_NAME=${SELECTED_OPT::-3}
break
fi
done
if [ -z "$LAYOUT_NAME" ]; then
echo "invalid option $REPLY"
else
break
fi
done
fi
echo
SPECIFIC_BRIGHTNESS_VALUES="$LAYOUT_NAME-$DEVICE_ID"
if [ -f "layouts/$SPECIFIC_BRIGHTNESS_VALUES.py" ];
then
LAYOUT_NAME=$SPECIFIC_BRIGHTNESS_VALUES
echo "Selected key layout specified by touchpad ID: $DEVICE_ID"
fi
echo "Selected key layout: $LAYOUT_NAME"