Today’s post is specific to those Irreal readers who use the Safari browser. As I’ve written many times, almost all my tube time is spent in either Emacs or Safari. A typical workflow occurs when I’m reading my RSS feed in Emacs with Elfeed. If I see a post that looks interesting, I have Elfeed launch the site in the browser. After I finish with the website, I delete the tab with ⌘ Cmd+w. This same process also happens in many other situations.
The problem is I often type the neighboring key ⌘ Cmd+q instead, which quits Safari and all the open tabs I was working on. That’s not too bad because Safari has an option to reload all the tabs from the previous session so I don’t really lose those tabs.
But there is a problem. When I quit Safari like that, I lose the mapping from F6 to Emacs and can only get it back by rebooting macOS. That’s a real problem because I’m constantly using F6 and F7 to switch between Emacs and Safari.
The last time it happened, I’d had enough and decided something had to be done. Surely, I thought, there must be a way to get Safari to query you before quitting. That’s what happens when you spend all your time in Emacs: you expect everything to be configurable. But Safari is not Emacs and there isn’t an option for asking for confirmation before quitting. I asked Duck Duck Go and found this post from John Gruber, who had similar problems. Gruber provides a bit of Apple Script to provide the confirmation dialogue but he mentions that if all you want to do it avoid confusing ⌘ Cmd+q with ⌘ Cmd+w, you can simply change (or remove) the shortcut for quitting Safari. That’s really easy to do: see Gruber’s post for the details.
Now I’m having the reaction I always have when I trivially solve some longstanding problem: why didn’t I do this earlier? I will, it appears, never learn.