dotfiles/files/.config/i3/bin/toggle-touchpad

21 lines
353 B
Bash
Executable file

#!/bin/bash
synclient=/usr/bin/synclient
prop='TouchpadOff'
if ! [ -x "$synclient" ]; then
exit 2
fi
state=$(${synclient} -l \
| grep "^ ${prop}" \
| sed 's/^.*= \([01]\)$/\1/g' \
| head -n 1)
if [ -z "$state" ] || $(echo "$state" | grep -vq '^[01]$') ; then
exit 1
fi
nState=$((($state + 1) % 2))
$synclient "$prop=$nState"