Skip to content

Instantly share code, notes, and snippets.

@prati0100
Created September 25, 2018 14:18
Show Gist options
  • Save prati0100/ff4c9b507a81ee07a6d3151c12f454a3 to your computer and use it in GitHub Desktop.
Save prati0100/ff4c9b507a81ee07a6d3151c12f454a3 to your computer and use it in GitHub Desktop.
Disables the touchpad of your laptop if a mouse is connected to it. I have set this script to run on start-up, because most of the times I have a mouse attached and don't want the touchpad enabled.
#!/bin/bash
read Mouse <<< $( xinput | grep Mouse )
if [ "$Mouse" = "" ]; then
# No mouse found, so don't disable the TouchPad
exit
else
# Mouse found. Disable the TouchPad
read TPdevice <<< $( xinput | sed -nre '/TouchPad/s/.*id=([0-9]*).*/\1/p' )
xinput --disable "$TPdevice"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment