aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/script/toggle-trackpad
blob: 67db181378a9d6d63cc22f8841c261d30f0ed5b3 (plain) (blame)
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
#!/bin/sh

usage() {
	printf "Usage:
  control-trackpad.sh disable [TRACKPAD]
  control-trackpad.sh enable [TRACKPAD]\n"
	exit 1
}


if [ -z "$1" ]; then
	usage
elif grep -q ThinkPad /sys/class/dmi/id/product_family; then
	if xinput | grep -q "SynPS/2 Synaptics TouchPad"; then
		trackpad="SynPS/2 Synaptics TouchPad"
	elif xinput | grep -q "Synaptics TM3276-022"; then
		trackpad="Synaptics TM3276-022"
	else
		echo "Couldn't recognize your trackpad, please provide a name of it"
		exit 1
	fi
elif [ -z "$2" ]; then
	echo "If you don't use a ThinkPad, you need to provide a name of a trackpad"
	exit 1
fi


if [ "$1" = "enable" ]; then
	xinput enable "$trackpad"
elif [ "$1" = "disable" ]; then
	xinput disable "$trackpad"
else
	usage
fi