In many applications, Command-P is used to print.
My fingers are accustomed to emacs settings and reflexively press Command-P not for printing but for browsing history. It's annoying to see the print pop-up window every time when I press Command-P. I don't need a shortcut to print.
How do you block a shortcut globally?
-
1I'd call this more "system-wide" than "application-specific"...– NReilinghCommented Nov 26, 2013 at 4:08
2 Answers
This can be achieved by remapping the Print shortcut to a different shortcut that is out of the way, unused and unlikely to be pressed.
Open System Preferences → Keyboard → Shortcuts → App Shortcuts.
Click + to add a new shortcut.
Application: All Applications
Menu Title: Print… (that's a 'proper' ellipses by the way, use copy-paste if necessary)
Keyboard Shortcut: Set it to something out of the way.
Click Add.
Now, the Print command is set to a random keyboard shortcut, freeing up ⌘P.
-
For me, all this does is make both the old as the new shortcut work. I want to disable Cmd + W in Cisco Packet Tracer which starts the activity wizard. As every other application in the universe closes the active tab with this shortcut i keep pressing it and needing to dismiss the wizard. Its really irritating me. Any ideas? Commented Apr 3, 2021 at 3:59
You can also use defaults to change the shortcut to something like U+200B (ZERO WIDTH SPACE):
defaults write -g NSUserKeyEquivalents -dict-add Print... '\U200b'
nil
would be triggered when pressing n in some applications like Audacity and \0
would be triggered when pressing any key in Safari in 10.9.
I use a shell script like this to configure the shortcuts:
defaults write -g NSUserKeyEquivalents '{
"Show Previous Tab"="~@\Uf702";
"Show Next Tab"="~@\Uf703";
"Minimize"="\U200b";
}'
defaults write com.apple.Finder NSUserKeyEquivalents '{
"Show Package Contents"="@\r";
}'
-
Thanks. That was a great tip. A note for dummies like me: it won't take effect until you relaunch the application.– honzaCommented Nov 26, 2013 at 6:24