Skip to content

Instantly share code, notes, and snippets.

@dmishh
Forked from smileart/key.sh
Created October 15, 2013 11:50
Show Gist options
  • Save dmishh/6990377 to your computer and use it in GitHub Desktop.
Save dmishh/6990377 to your computer and use it in GitHub Desktop.
# Add ’alias key='~/key.sh'’ to .bashrc or .zshrc
case "$1" in
"off") echo "Keyboard is temporary disabled"
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ > /dev/null 2>&1
;;
"on") echo "Keyboard is enabled again"
sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ > /dev/null 2>&1
;;
"easy") echo "Keyboard is temporary disabled. Press ’any key’ ;) to enable"
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ > /dev/null 2>&1
read -n 1 -s
sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/ > /dev/null 2>&1
;;
*) echo "Use 'on'/'off' or 'easy' commands!"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment