diff options
-rwxr-xr-x | touchpad.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/touchpad.sh b/touchpad.sh index 9bb6f6f..c05462b 100755 --- a/touchpad.sh +++ b/touchpad.sh | |||
@@ -1,5 +1,7 @@ | |||
1 | #!/usr/bin/env sh | 1 | #!/usr/bin/env sh |
2 | 2 | ||
3 | STATE_FILE="/tmp/touchpad-disabled" | ||
4 | |||
3 | case $1 in | 5 | case $1 in |
4 | "enable") | 6 | "enable") |
5 | ACTION="enable" | 7 | ACTION="enable" |
@@ -7,6 +9,13 @@ case $1 in | |||
7 | "disable") | 9 | "disable") |
8 | ACTION="disable" | 10 | ACTION="disable" |
9 | ;; | 11 | ;; |
12 | "toggle") | ||
13 | if [ -e "$STATE_FILE" ]; then | ||
14 | ACTION="enable" | ||
15 | else | ||
16 | ACTION="disable" | ||
17 | fi | ||
18 | ;; | ||
10 | *) | 19 | *) |
11 | echo "Invalid action." | 20 | echo "Invalid action." |
12 | echo "Usage: $0 enable|disable" | 21 | echo "Usage: $0 enable|disable" |
@@ -14,6 +23,12 @@ case $1 in | |||
14 | ;; | 23 | ;; |
15 | esac | 24 | esac |
16 | 25 | ||
26 | if [ "$ACTION" = "enable" ]; then | ||
27 | rm -f "$STATE_FILE" | ||
28 | else | ||
29 | touch "$STATE_FILE" | ||
30 | fi | ||
31 | |||
17 | DEVICES=$(xinput list --name-only | grep -i touchpad) | 32 | DEVICES=$(xinput list --name-only | grep -i touchpad) |
18 | 33 | ||
19 | if [ -z "$DEVICES" ]; then | 34 | if [ -z "$DEVICES" ]; then |