pgrep syndaemon &>/dev/null && sleep 1 # with syndaemon running, it will have disabled our touchpad now due to pressed
# keys. wait for it to enable it again so we can query the correct touch state
# FIXME: doesn't work very reliably tho
state=$(synclient -l | awk '/TouchpadOff/{print $3}')
case $state in
0) # touchpad is on
notify-send -i input-touchpad "$(basename "$0")" "Touchpad scrolling/tapping OFF" #"
killall syndaemon &>/dev/null
synclient TouchpadOff=2
;;
2) # touchpad scrolling/tapping is off
notify-send -i input-touchpad "$(basename "$0")" "Touchpad OFF" #"
killall syndaemon &>/dev/null
synclient TouchpadOff=1
;;
1) # touchpad is off
notify-send -i input-touchpad "$(basename "$0")" "Touchpad ON" #"
synclient TouchpadOff=0
xfconf-query -c pointers -p /DisableTouchpadWhileTyping | grep -q "true" && {
# re-enable syndaemon by toggling the option
xfconf-query -c pointers -p /DisableTouchpadWhileTyping -s false
xfconf-query -c pointers -p /DisableTouchpadWhileTyping -s true
}
;;
esac