Skip to content

Instantly share code, notes, and snippets.

@gregtaole
Created May 6, 2019 17:50
Show Gist options
  • Save gregtaole/370d4ecdf8dae54f2e2d07c1ad073627 to your computer and use it in GitHub Desktop.
Save gregtaole/370d4ecdf8dae54f2e2d07c1ad073627 to your computer and use it in GitHub Desktop.
Disable laptop touchpad when USB mouse is plugged
ACTION=="add", ATTRS{idVendor}=="093a", ATTRS{idProduct}=="2521", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/dinervoid/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/home/dinervoid/Documents/udev_scripts/disable_touchpad.sh 1"
ACTION=="remove", ATTRS{idVendor}=="093a", ATTRS{idProduct}=="2521", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/dinervoid/.Xauthority", ENV{ID_CLASS}="mouse", RUN+="/home/dinervoid/Documents/udev_scripts/disable_touchpad.sh 0"
#!/bin/bash
if [ $1 -eq 0 ]; then
/usr/bin/xinput enable "SynPS/2 Synaptics TouchPad"
else
/usr/bin/xinput disable "SynPS/2 Synaptics TouchPad"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment