So the Safari beta 4 has landed and opinions are all over the place about the new features. The most consistent target for criticism has been the changes to the tab interface. Although the differences were a little disconcerting at first, I’ve come to love the new tabs and I even took a cue from Safari and decided to improve one of my most precious tools: Panic‘s Coda.
I’ve been kind of bummed reading all the negative responses to Safari’s update because I’m so impressed by the damn thing. It seems like most of the gripers are claiming Apple ripped off Chrome‘s "Tabs-on-Top" layout and "Top Sites" feature or that Safari 4 isn’t as many times faster than every competitor as Apple claims. So… when Apple notices good design they’re not supposed to act on improving their product? Should Apple have included tabs at all since they certainly were not the first to develop the idea?. Nevermind the fact that Chrome wouldn’t even exist if Apple hadn’t shared WebKit with the world, since Chrome uses it exclusively for rendering. So what’s the problem with a few "good as new" bad-ass features, dudes? And if the absence of a handful of outdated Safari 3 behaviors is driving you nuts, you can easily bring them back.
The one cool thing that really put a smile on my face when trying out Safari 4 was discovering the new tab-switching keyboard shortcuts. It seems like every app in the world has tabs these days, and moving around between them is the most common (yet also most application-specific) task you will perform. Since the dawn of tab, developers haven’t been able to agree on a global shortcut to switch tabs and my mouse has suffered great wear as the battle rages on. I would guess this problem is a NIH related artifact from a time when tabs were the killer new feature to have, and no application had yet proven to be the ubiquitous tab-interaction authority. I’ve always found Safari 3’s built-in tab navigation key combo about as awkward as this sentence. Firefox certainly paved the way with some very intuitive shortcuts, but I only use Firefox for UI testing with Firebug, so rarely do I find myself treading water in a sea of tabs. Also, Safari 4’s new developer tools have pretty much guaranteed a serious decline in my Firebug time anyway.
With Safari 4, a great tab usage barrier has been shattered as the Firefox control-tab shortcut replaces Safari’s original loathsome key combo. I was so inspired by this move towards consistency (or additional Apple rip-off attempt as one could claim) that I decided to add it to another tab-defying application that I love so dearly: Coda.
The Leopard Way
Mac OS X provides a System Preferences pane that allows you to add, edit and remove global and application-specific keyboard shortcuts. It’s a handy little tool found under the "Keyboard & Mouse" preferences that somehow I’ve only used once… to change tab behaviors. A while back, I actually had the (impressively moronic) idea to change Coda’s tab shortcuts to command-tab so switching between tabs would be "as easy as switching applications." Now that’s taking Coda’s "one window development" tagline to the eXtR3m#.
Luckily for me, Leopard doesn’t allow you to use the tab key when defining new shortcuts, so I settled for command-~, which is the standard "switch windows within application" key command. "Mostly one window development" turned out to be a real drag though, because I frequently work on two or three Coda Sites at once, and found myself with no way to switch between Sites. Bummer.
It was looking like Apple was going to deny me my tab nirvana.
The Working Way
After poking around on Google, I discovered System Preferences stores application shortcuts in your preferences plist. It uses a dictionary value named NSUserKeyEquivalents to map the commands to the shortcuts and can be changed easily with defaults write. I also found that you can use the ^ character to represent the control key when defining your shortcuts, but what about tab? Brute force experimentation landed me in tab heaven on my first try. Here is how to make control-tab and control-shift-tab map to "Select Next Tab" and "Select Previous Tab" respectively in Coda:
stewart:~ xdissent$ defaults write com.panic.Coda NSUserKeyEquivalents -dict-add "Select Next Tab" '^\t' stewart:~ xdissent$ defaults write com.panic.Coda NSUserKeyEquivalents -dict-add "Select Previous Tab" '^$\t'