Warn before quitting in Safari
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.
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).
If you do want quit Safari, you can use this shortcut, or quit from the menu.
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!