diff options
author | Pacien TRAN-GIRARD | 2016-03-07 11:57:25 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-03-07 11:57:25 +0100 |
commit | 690efe35a852fdc625a74f4bb23b9836eb422f2f (patch) | |
tree | 43394b939a6f87c885682171f5ebcf0648149952 | |
parent | a2e1d274224e7e5e6a9afd519fdbe5276c4f08c1 (diff) | |
download | desktop-utilities-690efe35a852fdc625a74f4bb23b9836eb422f2f.tar.gz |
Add touchpad control script
-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 | |||