Created
September 25, 2018 14:18
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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