Created
April 28, 2012 21:23
-
-
Save kd35a/2522153 to your computer and use it in GitHub Desktop.
Script than enables or disables a device
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 | |
#-------------------------------------------------------------------- | |
# Authur: Fredrik "kd35a" Strandin <fredrik [at] strandin (dot) name> | |
# License: WTFPL (Do What The Fuck You Want To Public License) | |
# --- | |
# Disable or enables a specific input device. | |
# Use 'xinput --list' to see which device you want to enable/disable. | |
#-------------------------------------------------------------------- | |
# Configuration | |
# Which device to enable or disable, see 'xinput --list'. | |
DEV=$(xinput --list --id-only "AT Translated Set 2 keyboard") | |
# End of configuration | |
if [ ! "$#" -eq 1 ]; then | |
echo "Error, wrong number of parameters. Usage: '$0 < enable | disable >'" | |
exit 1; | |
fi | |
if [ "$1" == "enable" ]; then | |
DISPLAY=:0.0 xinput set-int-prop $DEV "Device Enabled" 8 1; | |
exit 0; | |
fi | |
if [ "$1" == "disable" ]; then | |
DISPLAY=:0.0 xinput set-int-prop $DEV "Device Enabled" 8 0; | |
exit 0; | |
fi | |
echo "Lol, only 'enable' and 'disable' are valid arguments"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment