Skip to content

Instantly share code, notes, and snippets.

@cesalazar
Created June 22, 2017 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cesalazar/ae9e2c49d2bcac125ae025aebd80fbaf to your computer and use it in GitHub Desktop.
Save cesalazar/ae9e2c49d2bcac125ae025aebd80fbaf to your computer and use it in GitHub Desktop.
Toggle the TrackPad on or off
#!/bin/sh
device='SynPS/2 Synaptics TouchPad'
state=$(xinput --list-props "$device" | grep 'Device Enabled' | awk '{print $4}')
action=$([ "$state" = 1 ] && echo "--disable" || echo "--enable")
notify=true
timeout=1000
iconPath=/usr/share/icons/Adwaita/22x22/actions/
iconOff=zoom-out.png
iconOn=zoom-in.png
icon=$([ "$state" = 1 ] && echo "$iconPath$iconOff" || echo "$iconPath$iconOn")
msg=$([ "$state" = 1 ] && echo "TouchPad Disabled" || echo "TouchPad Enabled")
xinput "$action" "$device"
if [ $notify = true ]
then
notify-send -t $timeout -i "$icon" "$msg"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment