Feb 6

Re-mapping “Quit” to “About” in Safari on macOS

Category: apple,mac,macosx,tips

One of the most annoying things for me about the QWERTY keyboard is the location of the “Q” key next to the “W” key. If you’re not a Mac user and if you’re not someone who heavily uses keyboard shortcuts you probably have no idea what I’m talking about. However if you are a keyboard heavy Mac user like myself you’ve probably run into the situation where you meant to hit Command-W to close a window but you accidentally hit Command-Q to close the entire application.

This can range from annoying to near data loss situations depending on the application you’re in. For me in the case of Safari, I have a lot of tabs and windows. Hundreds of tabs and tens of windows at one stage. Hitting Command-Q on that doesn’t lose me data but it does unload it from memory. Then I need to relaunch Safari again and it has to reload all of those tabs. This can range from a mild annoyance if I’m not in the middle of something right up to being a massive pain because I’m not somewhere with good internet or potentially any internet like a plane.

Now I have a work around I use to prevent me from unintentially quitting Safari when all I wanted to do is close a window or even tab to another application. This workaround just saved me from accidentally quitting Safari and triggered me to write this blog post!

The work around I use for this problem is to utilise the Mac’s global keyboard shortcut preferences. For any Mac application, there is one central location you can use to set keyboard shortcuts, even for menu items that don’t have a keyboard shortcut. In this case I want to re-map Command-Q to something a little more innocuous like “About Safari”.

To do this I head to “System Preferences” on the Mac, find the “Keyboard” preference pane and then inside of that head to the “Shortcuts” tab. This tab is split in two wiht a bunch of options on the left including “App Shortcuts”.

Adding a new entry is as simple as clicking the “+” icon at the bottom of the list, selecting the Application this applies to (or leaving it to “All Applications”), entering in the exact menu title and then putting in the new keyboard shortcut. For the “About Safari” remapping, it looks like this:

When you clik “Add”, it’ll add this to the list. I actually have a couple of shortcuts setup to make my life a little easier:

As you can see I’ve got a few options here. The Zoom one enables me to quickly resize windows though the shortcut for it is a little annoying because the Z key is a little overloaded. I also have another setting for Safari to activate the “Disable JavaScript” mode from the “Develop” menu (enable it in Safari’s preferences). This is useful for working around annoying JavaScript settings. Finally I’m a gamer and I also subscribe to Humble Monthly which means new Steam keys every so often. I got annoyed going to the menu every time and added this shortcut to add a key to the Library so that I could do as little mouse movements as necessary.

You can see that this allows you to change keyboard shortcuts for menu items in various applications relatively easily and even override existing values. Now my Safari menu looks like this:

You’ll notice that “Quit Safari” no longer has a shortcut and instead “About Safari” has the shortcut.

Now if you’re using Google Chrome, this feature is actually built in as “Warn Before Quitting” in the menubar. When enabled it requires you to hold down Command-Q to quit the application. Looks like I’m not the only one with the problem. Check out these posts on Lifehacker or OMG! Chrome for more details on Chrome’s “Warn Before Quitting” feature.

No comments

No Comments

Leave a comment

%d bloggers like this: