diff options
-rwxr-xr-x | touchpad.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/touchpad.sh b/touchpad.sh new file mode 100755 index 0000000..9bb6f6f --- /dev/null +++ b/touchpad.sh | |||
@@ -0,0 +1,30 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | case $1 in | ||
4 | "enable") | ||
5 | ACTION="enable" | ||
6 | ;; | ||
7 | "disable") | ||
8 | ACTION="disable" | ||
9 | ;; | ||
10 | *) | ||
11 | echo "Invalid action." | ||
12 | echo "Usage: $0 enable|disable" | ||
13 | exit | ||
14 | ;; | ||
15 | esac | ||
16 | |||
17 | DEVICES=$(xinput list --name-only | grep -i touchpad) | ||
18 | |||
19 | if [ -z "$DEVICES" ]; then | ||
20 | echo "No touchpad found." | ||
21 | exit | ||
22 | fi | ||
23 | |||
24 | IFS=' | ||
25 | ' | ||
26 | |||
27 | for DEVICE in $DEVICES; do | ||
28 | xinput "$ACTION" "$DEVICE" | ||
29 | done | ||
30 | |||