Skip to content

Instantly share code, notes, and snippets.

@wildonion
Created October 26, 2020 21:11
Show Gist options
  • Save wildonion/cb0a18652b4e2610f0433a975b7e69b5 to your computer and use it in GitHub Desktop.
Save wildonion/cb0a18652b4e2610f0433a975b7e69b5 to your computer and use it in GitHub Desktop.
touch-pad controller script
#!/bin/bash
read TPdevice <<< $( xinput | sed -nre '/TouchPad|Touchpad/s/.*id=([0-9]*).*/\1/p' ) # getting the id of the touchpad device
state=$( xinput list-props "$TPdevice" | grep "Device Enabled" | grep -o "[01]$" ) # getting the status of touchpad
if [ "$state" -eq '1' ];then
xinput --disable "$TPdevice" && notify-send -i emblem-nowrite "Touchpad" "Disabled"
else
xinput --enable "$TPdevice" && notify-send -i input-touchpad "Touchpad" "Enabled"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment