Sunday, January 20, 2008

Leopard's Terminal Tabs

As I shared yesterday, I love tabs. One of the few good things that MacOS 10.5 Leopard brought, was enhanced Terminal application. A basic feature - Tab support - that was missing in Terminal for way too long, was finally added, and Terminal app became finally usable for anyone who spends a great time of the day working on the command line.

Before Leopard, I used iTerm, but there was just something about it that I didn't like, but the availability of tabs made me get over it. Now with Leopard there is no need for iTerm any more.

Just to point out that Apple seems to be unable to get anything 100% right these days, there are two flaws in the Terminal's tab implementation.

The first flaw is that you can't easily switch between tabs using keyboard shortcut. All you can do is to use cmd+{ and cmd+} to switch to previous or next tab respectively. What a "wonderful" choice of keys that require use of right hand or both hands. Most importantly, one can't use the handy cmd+1, cmd+2, ..., cmd+9 shortcuts (or anything similar) to switch to one of the first nine tabs. Maybe Apple doesn't want to overload us with new features and is planning to add this to Terminal in MacOS 10.6. :-) Fortunately, the cmd+{ and cmd+} shortcuts can be remapped via System Preferences.

The second flaw is that Terminal doesn't let you name the tabs or configure how the tabs should be named. This is a useful feature that many other terminal applications have, but Apple decided that using the name of the program of the currently running process is good enough. Well, this is what it looks like:

People are doing all kinds of crazy things to work around this issue. Including using hardlinks to change names of programs or creating dummy processes that carry the tab name.

I would be very happy if Apple did something similar to what xterm does - using an environmental variable to set name of the tab dynamically. But I have a feeling that we'll see MacOSX Trash go 3D sooner than properly working Terminal tabs. :(

14 comments:

Shawn Ferry said...

Have you thought about screen? I admit that I am using both screen and Terminal.app tabs.

I had been using CodeTek then Virtue then spaces and a terminal per-virtual desktop (plus screen).

None of these is quite satisfactory.

Igor Minar said...

I know and love screen. I can't imagine working over ssh without it. But for localhost activities it'd rather use terminal tabs instead so that I can scroll up and down with my touchpad instead of the keyboard.

Nathan said...

I'm obsessed with finding a solution that allows me to name my tabs, either manually, or by the hostname that I'm ssh'd into. Please let me know if you find something. I'll do the same for you.

Thanks,

Nathan

Anonymous said...

Trying to redefine the key binding, I found NO way to bind the "Previous Tab" and "Next Tab" to the more consistent "alt-cmd-arrow" nor to override the default "cmd-arrow", used to switch between windows. The only solution is to use the default "cmd-shift-arrow" to move between tab which is much less effective but less worst than the "}".

Indedd Apple seems to have a lower quality output for OSX ... probably because they've put the best developpers on the iPod and kept the newbies on the OSX.5 release.

Anonymous said...

I've written a SIMBL plugin to take care of this. Its only Alpha but you should check it out.

Terminal.app Tab Namer

Shawn Ferry said...

@eric Sweet, I see that your plugin causes the tab to use the Prefs. -> Settings -> Window -> Title as the default tab title.

That rocks and works well for me.

Colin said...

you can change the tab shortcut behavior easily, in the global system preferences (under keyboard and mouse).

Igor Minar said...

Yup, that's what I mentioned in the blog post.

Anonymous said...

Seems that Apple has fixed the naming issue (though it's somewhat clunky). You can right-click on the tab, Inspect Tab and change the title.

Glen said...

It's not so clunky if you use the CMD+I shortcut.

Glen said...

It's not so clunky if you use the CMD+I tab.

Now moving tabs with the keyboard, that's what I'd be interested in.

The mouse is so 2005.

Shawn Ferry said...

SHIT-CMD-[ and SHIFT-CMD-] (CMD-{ CMD-})

Nik said...

Cmd shift left/right

Igor Minar said...

Now do it with one (preferably left) hand about 1000 times a day and tell me how you like it.