I would like to disable keyboard shortcuts Command-W and Command-Q in Mac OS X 10.8 Mountain Lion.
This is because they interfere with emacs commands which I run from inside a terminal running from xQuartz. How can I disable the keyboard shortcuts?
I would like to disable keyboard shortcuts Command-W and Command-Q in Mac OS X 10.8 Mountain Lion.
This is because they interfere with emacs commands which I run from inside a terminal running from xQuartz. How can I disable the keyboard shortcuts?
BetterTouchTool is no longer free.
I reached this page because I wanted to disable command-h (hide application) which is not shown in System Preferences. This is my solution.
BetterTouchTool is a utility which can disable keyboard shortcuts (and has many other uses). http://www.boastr.de/
To disable command-w globally
Note that you can also set a keyboard shortcut for a specific application.
To disable command-w only for Terminal
BetterTouch wasn't able to change or disable the key that was causing me grief: ctrl-cmd-d.
Here is how I was able to delete it:
open ~/Library/Preferences/com.apple.symbolichotkeys.plist
From this site I learned about symbolic hot keys and found a list of them: http://www.theregister.co.uk/2009/02/24/hotkeys_framework2/
These sites have lists of the codes used in the plist file, so one can actually change the shortcuts instead of only deleting them: http://krypted.com/mac-os-x/defaults-symbolichotkeys/ and Documenting com.apple.symbolichotkeys.plist.
To view or change Keyboard shortcuts:
A solution that may work for factory hotkeys in individual apps which conflict with your desired assignment:
Use the built-in hotkey management:
System Preferences | Keyboard | Shortcuts | App Shortcuts
...to map the pre-existing to some hard-to-hit keyboard combination (like Cmd-Opt-Shift-backslash). This will free-up the old key combination for assignment.
Which highly recommend is hammerspoon, who defined GOD LIKE
!
install hammerspoon
vim ~/.hammerspoon/init.lua
paste this hs.hotkey.bind("cmd", 'H', function()end)
in
:wq
and then StatusBar -> Hammerspoon -> ReloadConfig
done!
Happy Hack!
Following an article on how to script shortcuts I tried setting a shortcut to ''
to no avail, but setting it to NULL
worked fine. Here's an example:
TAB_KEY_SYMBOL="\\U21e5"
COMMAND_KEY_SYMBOL="@"
SHIFT_KEY_SYMBOL="$"
defaults write com.apple.finder NSUserKeyEquivalents "{ 'Show Package Contents' = '${COMMAND_KEY_SYMBOL}${SHIFT_KEY_SYMBOL}O'; }"
defaults write com.apple.finder NSUserKeyEquivalents -dict-add 'Add to Sidebar' '\U0000'
defaults write com.apple.finder NSUserKeyEquivalents -dict-add 'Add to Dock' '\U0000'
# kill finder and prefs daemon
killall Finder
killall cfprefsd
# *only* if absent, add bundle id to make it show up in keyboard prefs pane
defaults read com.apple.universalaccess "com.apple.custommenu.apps"
defaults write com.apple.universalaccess "com.apple.custommenu.apps" -array-add "com.apple.finder"
$ defaults read com.apple.finder NSUserKeyEquivalents
{
"Add to Dock" = "";
"Add to Sidebar" = "";
"Show Package Contents" = "@$O";
}