Last active
December 25, 2015 14:19
-
-
Save smileart/6990307 to your computer and use it in GitHub Desktop.
Little shell script to manage (enable/disable) keyboard on Mac
WARNING! To enable keyboard, use Keyboard Viewer from keyboard layout menu
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
# Add ’alias key='~/key.sh'’ to .bashrc or .zshrc | |
case "$1" in | |
"off") sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ > /dev/null 2>&1 | |
echo "Keyboard is temporary disabled" | |
;; | |
"on") sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ > /dev/null 2>&1 | |
echo "Keyboard is enabled again" | |
;; | |
"easy") sudo -K | |
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ > /dev/null 2>&1 | |
echo "Keyboard is temporary disabled. Press ’any key’ ;) to enable" | |
read -n 1 -s | |
sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ > /dev/null 2>&1 | |
sudo -k | |
echo "Keyboard is enabled again" | |
;; | |
*) echo "Use 'on'/'off' or 'easy' commands!" | |
;; | |
esac | |
sudo -k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment