Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Many, many times, I accidentally press +Q when I meant to close a tab or window, or switch applications. When I saw the option in Google Chrome to require the shortcut to be held, I was overjoyed. Problem is, I use Safari.

So, in short: How can I make the "hold command-Q" shortcut universal across all of my applications (or at least Safari)?

share|improve this question
3  
Where is this setting you speak of? –  Senseful Mar 22 '12 at 20:02
    
Awesome question Timothy!! –  daviesgeek Mar 22 '12 at 20:03
2  
@Senseful It's counterintuitively under the Chrome menu, rather than Chrome preferences. –  timothymh Mar 22 '12 at 20:04
4  
"Warn Before Quitting." –  timothymh Mar 22 '12 at 20:04
    
Great question, leading to very useful answers! –  Paul Wagland Mar 29 '12 at 21:33

4 Answers 4

Continuing on jtbandes' solution, once you have remapped the standard Quit command to a different keystroke (yes, sadly, you need to remap it manually for every application you are worried about accidentally quitting), you can create a service in Automator that takes no input. It should have a single action: Run AppleScript. The script is:

tell application "System Events"
    set theName to name of the first process whose frontmost is true
end tell
tell application theName
    display dialog "Are you sure you want to quit?"
    quit
end tell

You then save that service (I called mine "SafeSave"), and assign the service the keystroke Q. You have thus reclaimed the standard keystroke.

share|improve this answer
    
Clever. Hm, I suppose one could write a script to activate on cmd-Q which would then require another cmd-Q to complete the quit... –  timothymh Mar 23 '12 at 0:42
    
Clever, indeed! Have an up vote! :-) –  Asmus Mar 23 '12 at 8:37
    
Very nice, I have implemented, and upvoted! –  Paul Wagland Mar 29 '12 at 21:34

Here's a partial solution for starters:

Preventing accidental quitting in Safari (or any specific application)

Simply set up an unusual keyboard shortcut for the "Quit Safari" menu item in Keyboard preferences.

This will disable the standard Q shortcut, so accidentally hitting it doesn't make a difference — and you have to think before you quit!

(Unfortunately, I haven't found an easy way to do this for every application, without entering each one manually.)

share|improve this answer
    
Very nice, I have implemented, and upvoted! As an aside, by default ⌥⌘Q is "Quit and discard Windows". –  Paul Wagland Mar 29 '12 at 21:37
    
Oh drat, you're right. Well, ⌃⌘Q or something else should work too — however I find ⌥⌘Q a little harder to hit by accident. –  jtbandes Mar 29 '12 at 21:58

Another option is to use KeyRemap4MacBook:

__HoldingKeyToKey__ KeyCode::Q, VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_NONE, KeyCode::Q, VK_COMMAND, Option::NOREPEAT

share|improve this answer
up vote 0 down vote accepted

CommandQ ($4.00) does exactly this. It's very customizable and has a nice GUI, though I haven't used it personally. It seems to fulfil the requirements of this question.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.