Created
March 14, 2018 14:26
-
-
Save Mnkai/a43f7c0680633204856cde56961b6dcd to your computer and use it in GitHub Desktop.
Toggle keyboard device - useful if you are using external keyboard on your laptop's keyboard
This file contains 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/sh | |
# Change keyboard device name to your own - e.g., xinput list | |
KEYBOARD_DEV_NAME="AT Translated Set 2 keyboard" | |
KEYBOARD_DEV_ID=$(xinput list | grep "$KEYBOARD_DEV_NAME" | cut -f 2 | cut -d "=" -f 2) | |
KEYBOARD_ISENABLED=$(xinput list-props $KEYBOARD_DEV_ID | grep "Device Enabled" | cut -d ":" -f 2) | |
if [ $KEYBOARD_ISENABLED -eq 1 ]; then | |
xinput disable $KEYBOARD_DEV_ID | |
elif [ $KEYBOARD_ISENABLED -eq 0 ]; then | |
xinput enable $KEYBOARD_DEV_ID | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment