14

Is it possible to activate some safety check, like "Warn Before Quitting" in Chrome, to quit Safari? Sometimes we can press Q by mistake, and it's a pain to have the entire application closed.

  • Indeed, this is a big problem for me. Chrome and Opera both provide this option (not sure about Firefox since I seldom use it). The loss is too great when I have typed ten paragraphs and accidentally hit Command Q (some websites with text fields do not warn before closing tabs). I actually began to like Safari 8 and am moving more and more of my browsing to Safari (before Yosemite I never gave it a s**t); but this, coupled with other missing features (e.g. prompt for each download) is still preventing Safari from becoming my default. – 4ae1e1 Dec 1 '14 at 0:52
18

Fabio's answer seems not to works as expected, not sure if I have a different version of BTT, or osx. Anyway, I found another option: simply bind Quit Safari with another keybinding.

Go to system preferences -> Keyboard -> Shortcuts -> App Shortcuts -> Add new one ('+' sign) -> Choose Safari from the Application menu -> Enter in the Menu Title the exact text: Quit Safari -> Set another shortcut than cmd-Q, I used ^-cmd-Q (option+command+q). Snapshot

If you do want quit Safari, you can use this shortcut, or quit from the menu.

  • This solution is was asked for Safari, but is not limited and can be applied to any application. – user890739 Feb 16 '18 at 20:31
5

My tweak is to use BetterTouchTools and set Q to run the following script:

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

This works fine, but it isn't neat.


A few more detailed steps for newbies:

  • Open up script editor, paste the script above, save anywhere safe as something like "quit script"
  • Open up BetterTouchTool, go to the Keyboard section,
  • Select Global for ALL apps or Safari (or whatever app) for just that one
  • Record a Cmd+Q as the keystroke
  • In the perform action popup, search for 'script' and choose the 'launch app/script' choice.
  • now select your script file.
  • viola!
0

I have a quick solution for users who own Keyboard Maestro. The key idea is to prevent quitting the application when the Command + Key is pressed, and allow quitting application when you hold the key combination for a specific amount of time.

You can download the macro at https://sayzlim.net/warn-before-quitting-macro/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .