Created
May 21, 2015 11:51
-
-
Save flipsi/eb0f1eb5e963233d5f38 to your computer and use it in GitHub Desktop.
Toggle Input Device Enabled (Like Touchpads)
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 | |
# Author: Philipp Moers <soziflip gmail com> | |
# This script disables an xinput device if it is enabled and vice versa | |
# adjust this to your needs | |
DEVICE="PS/2 Logitech Wheel Mouse" | |
# --------------------------------------------------------------------- | |
# get old state | |
STATE=$(xinput --list-props "$DEVICE" | grep "Device Enabled" | cut -f3) | |
# calculate next state | |
if [ $STATE -eq 1 ]; then | |
NEXTSTATE=0 | |
else | |
NEXTSTATE=1 | |
fi | |
# set next state | |
xinput --set-prop "$DEVICE" "Device Enabled" $NEXTSTATE | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment