Using screen with multiple tabs in Apple’s Terminal.app

Posted in Code, Websites or Tools

I’ve explored this topic in the past, and even tried my hand at writing some AppleScript when we moved to OS X Leopard. I found a solution way-back-then, and with all the new servers in place I wanted to replicate my setup for these new machines.

My current configuration is like this: I have a dock stack which opens a list of pre-configured Terminal settings. Clicking on a Transformer icon opens a Terminal with four tabs. Inside each tab I SSH to the appropriate machine and reconnect to a named screen session.

Transformer Icons

Sounds complicated, right? It’s not, really.

I thought I’d be able to edit an existing .terminal file and change the necessary settings for a new machine, but that didn’t work. What I need to do is create four seperate Window configurations and wrap them in a single Window Group. Here’s how you do that.

Firstly, open Terminal. Get to the Window menu through Terminal > Preferences... > Settings. Make a new setting and configure all the details as you like. You can also copy an existing setting to use as the base (which is what I did). I called my Window setting “Jazz 1″. Choose the Shell tab and click the “Run command” checkbox. Enter ssh -t jazz 'screen -d -R tfg_1' as the command, and check “Run inside shell.” This means when you open this Window you’ll ssh to jazz (change your server details here) and execute screen.

Now I copy this to Jazz 2, Jazz 3, and Jazz 4. For each Window you’ll need to change the name of the screen session to tfg_2, tfg_3 or tfg_4. You might name your screen sessions differently.

Open a new Terminal and open the Jazz 1 Window by choosing Shell > New Window > Jazz 1. Repeat the same process for Jazz 2, 3 and 4 but choose Shell > New Tab instead. Now you’ll have your four-tabbed Terminal with each tab logged into the remote server. We save this configuration by choosing Window > Save Window as Group... from the menu. Open your Window Group and drag the newly created configuration onto your desktop. You’ll now have a .terminal file on your filesystem which you can use to open this exact configuration in the future.

Change the icon and drag it into the dock and you’re all done!

No Comments

No comments have been left yet, be the first.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Twitter

Great web stats at @petrescue , the driving force behind the rebuild of their systems by @frontiergroup . http://t.co/MTvfoxnU

@frontiergroup about 2 weeks ago #

Search Posts

Featured Posts

Categories

Archives

View more archives