blob: c05462b903114e227a329cb00bcf32f2af3aa2b9 (
plain)
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
|
#!/usr/bin/env sh
STATE_FILE="/tmp/touchpad-disabled"
case $1 in
"enable")
ACTION="enable"
;;
"disable")
ACTION="disable"
;;
"toggle")
if [ -e "$STATE_FILE" ]; then
ACTION="enable"
else
ACTION="disable"
fi
;;
*)
echo "Invalid action."
echo "Usage: $0 enable|disable"
exit
;;
esac
if [ "$ACTION" = "enable" ]; then
rm -f "$STATE_FILE"
else
touch "$STATE_FILE"
fi
DEVICES=$(xinput list --name-only | grep -i touchpad)
if [ -z "$DEVICES" ]; then
echo "No touchpad found."
exit
fi
IFS='
'
for DEVICE in $DEVICES; do
xinput "$ACTION" "$DEVICE"
done
|