-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtp
More file actions
executable file
·39 lines (36 loc) · 1 KB
/
tp
File metadata and controls
executable file
·39 lines (36 loc) · 1 KB
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
#!/bin/bash
if [[ -n $(which xinput) ]]; then
use_xinput=1
tp_id=$(xinput --list --long | grep -io "touchpad.*id=[0-9]\+" | grep -o "[0-9]\+")
fi
if [[ $1 == "on" ]]; then
if [[ -n $use_xinput ]]; then
xinput --enable "$tp_id"
else
synclient touchpadoff=0
fi
elif [[ $1 == "off" || $1 == "move" ]]; then
if [[ $1 == "off" ]]; then
if [[ -n $use_xinput ]]; then
xinput --disable "$tp_id"
else
synclient touchpadoff=1
fi
fi
# move cursor to bottom right corner of screen
xdotool mousemove $(xrandr | grep '*' | head -n 1 | awk '{ print $1 }' | tr 'x' ' ')
else
if [[ -n $use_xinput ]]; then
if [[ $(xinput --list "$tp_id" | grep 'disabled') ]]; then
echo "touchpad is off"
else
echo "touchpad is on"
fi
else
if [[ $(synclient | grep "TouchpadOff.*0") ]]; then
echo "touchpad is on"
else
echo "touchpad is off"
fi
fi
fi