summaryrefslogtreecommitdiff
path: root/touchpad-toggle
blob: 66b5377c0248641b55b0c8fed6ac9b6b5f3152c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env zsh
STATUSFILE="/run/user/${UID}/touchpad_disabled"
DEVNAME='ETPS/2 Elantech Touchpad'

(($#)) || [[ ! -r $STATUSFILE ]]

case ${1:-$?} in
    (1|'on') toggle='enable' flag_action=('/usr/bin/rm' '-f');;
    (0|'off') toggle='disable' flag_action=('/usr/bin/touch');;
    (*) exit 1;;
esac
/usr/bin/xinput $toggle $DEVNAME
$flag_action[@] $STATUSFILE
/usr/bin/notify-send "Touchpad ${toggle}d"