OS X Tip: Remapping keyboard shortcuts
On my Mac, Apple+W is the shortcut for closing a window (or tab in a tabbed application such as Safari or Firefox) while Apple+Q quits the application completely. These keys are right next to each other on the keyboard. Today, for the final time, I hit the wrong key and accidentally sent a couple of days accumulation of useful browser windows straight in to the abyss. I say for the last time because my intended IRC rant about the stupidity of setting those two keys right next to each other was cut off by Richard Soderberg, who showed me how to remap keyboard shortcuts for any application in OS X.
- Bring up the Keyboard & Mouse preference pane.
- Hit the Keyboard Shortcuts tab.
- Click the + icon.
- Select Firefox from the Application menu.
- In the Menu Title box, enter the exact text “Quit Firefox”.
- In the Keyboard Shortcut box, enter a new shortcut (crysflame suggested Option-Apple-Q).
- Click Add.
You’ll need to restart Firefox to see the change, but sure enough the old keyboard shortcut has been replaced—and the menu has even been updated to reflect the change! Magic. I’d be interested to know what happens when you try this in apps that have more than one menu item with the same name. Right now I’m going through all my other multi-window apps (SubEthaEdit, Safari etc.) and remapping their quit keys as well.
<key>NSUserKeyEquivalents</key> <dict> <key>Quit Safari</key> <string>@~Q</string> </dict>it looks like the string will always be "Quit $app_name", so given a list of the app names you could use plistlib to add the other key/string pairs to the plist file.rayg - 8th June 2004 05:21 - #
Micah - 8th June 2004 06:06 - #
For me this is only really a problem with a tabbed browser, as I don't close windows/tabs as much, or have anywhere near as many open windows/tabs, in other applications. I wonder why the browser doesn't remember all the tabs/windows you had open when you last quit, then redisplay them from cache when you start the program again. It seems like it'd be easy to do, and it would make this problem far less annoying.
oli - 8th June 2004 06:31 - #
I don't think my frustration level has hit as high as yours yet, Si, but I feel your pain. A number of times I've had to wade through the history panel (which is really annoying because you can't open all in tabs) trying to find things I've lost when the Windows restart randomly feature rears its ugly head :-\
oli, that would be bloody fantastic. Someone told me once there is a Firefox extension to do that -- but I haven't got around to finding it either.
Meri - 8th June 2004 07:52 - #
Nick - 8th June 2004 11:49 - #
Nick, yep, me too.
My only beef with SessionSaver is that it works a bit too quietly; it saves the session from the last window closed, so that if you close your tabbed window before a separate one (a popup, or a link opened in a separate window), you're stuck with a "session" consisting of the last window closed.
...Perhaps the warning extension will do to avoid that.
Jeremy Dunck - 8th June 2004 16:28 - #
Just back from trying TabWarning. Seemed like it'd be dandy.
Don't use it; it apparently conflicts with Session Saver, such that you get a handy warning, and then don't have a saved session when you next start. Not much help there...
On a related note, this sort of geeky extension cobbling and incompatibility worry probably results in extensions being used a lot less by the mainstream.
Jeremy Dunck - 8th June 2004 16:35 - #
I don't think your real problem is that the W and Q keys are so close together. Your real problem is that you have applications which will closed windows in an unsaved state.
Now, if you try and close a Word document with typed-but-unsaved changes, it'll ask you for confirmation. It's easy to understand that the document is "dirty", because the changes are obvious. It's not so obvious what constitutes a "dirty" state for read-only (-mostly) documents, like a web browser window.
I think Mozilla (at least 1.7) does a fairly nice job of asking me if I really want to quit with X number of tabs open. Firefox really ought to do this, as a built-in feature. The only thing better is the always-saved nature of Workspaces in OmniWeb 5 (apparently similar effects can be accomplished with various Mozilla and Firefox plug-ins).
Applications that behave well is a better solution, IMHO, than manually changing your keyboard shortcuts to something that (a) no one else will be able to use (not necessarily bad), and (b) you will only be able to use on your own machine(s), and (c) is a pain in the ass to configure.
Alderete - 8th June 2004 17:12 - #
jacob - 8th June 2004 18:14 - #
david - 8th June 2004 20:20 - #
eLephant - 9th June 2004 06:58 - #
David Robarts - 9th June 2004 07:15 - #
Scott Johnson - 9th June 2004 07:16 - #
Simon Willison - 9th June 2004 08:23 - #
Steve - 3rd September 2005 05:16 - #
wow-gold - 5th September 2005 10:32 - #