summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-03-07 12:16:48 +0100
committerPacien TRAN-GIRARD2016-03-07 12:16:48 +0100
commit649757fde2d8874e9544be2ac1deefde27215b18 (patch)
tree3b6dca3023e3f37427776a6ff099834c145c2ae2
parent690efe35a852fdc625a74f4bb23b9836eb422f2f (diff)
downloaddesktop-utilities-649757fde2d8874e9544be2ac1deefde27215b18.tar.gz
Add toggle option to touchpad control
-rwxr-xr-xtouchpad.sh15
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
3STATE_FILE="/tmp/touchpad-disabled"
4
3case $1 in 5case $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 ;;
15esac 24esac
16 25
26if [ "$ACTION" = "enable" ]; then
27 rm -f "$STATE_FILE"
28else
29 touch "$STATE_FILE"
30fi
31
17DEVICES=$(xinput list --name-only | grep -i touchpad) 32DEVICES=$(xinput list --name-only | grep -i touchpad)
18 33
19if [ -z "$DEVICES" ]; then 34if [ -z "$DEVICES" ]; then