about: twothirds | twothirds on the go (mobile) | Race Checklists

Saturday, May 27, 2006

Fixing the Mac "Terminal" with gnone-terminal

Update: iTerm may not suck anymore


While I have been happy with my recent switch to OS X for "home" usage, the mac--er OS X has not been as friendly for "work" usage. Since I spend most of my day hooked up to various machines through a command prompt, a quality "terminal" application is of the utmost importance. Some of the good qualities I look for in a terminal app are:
  • Auto copy mouse selection to the clipboard
  • Auto paste clipboard with middle mouse click
  • Tabs
  • Large scroll buffer
  • Focus follows mouse
  • Configure text selection characters (Hint: -A-Za-z0-9,./?%&#:_)
  • Reliability (aka does not crash)

Terminal.app
The "out of the box" option with OS X was pretty unusable. I immediately tossed the default OS X terminal since it could not copy the selection to the clipboard or paste with the middle mouse button.

xterm
After installing X11, the default "xterm" was a viable options, but it is a bit too barebones. Mainly, it lacks a proper scrollback, tabs are lacking and it is difficult to configure.

iCrashTerm
iTerm supported everything I wanted, but it would crash whenever I pasted a larger buffer. Since a crash causes data loss, iTerm was tossed.

gnome-terminal
Taking a look at the Darwin Ports project, I found what I needed--gnome-terminal. Since this has been my default terminal on solaris and linux for the past few years, this would be a welcome addition to the mac. After installing Darwin Ports, I was happily hacking away in my terminal of choice on Linux and Solaris.

gnome-terminal on the dock
I was able to configure gnome-terminal in the X11 menu, but I wanted to launch gnone-terminal from the dock. Below are the steps to get it done.

Assumptions:
  • X11 is installed
  • gnome-terminal is installed

The steps:
  1. Launch AppleScript (Applications > AppleScript > Script Editor)
  2. Create the following script:

    do shell script "/usr/bin/open-x11 /opt/local/bin/gnome-terminal > /dev/null 2> 1 & "

  3. Save the script somewhere using "application" as the file format
  4. 2xClick the new app and gnome-terminal will launch. If X11 has not been launched yet, this should launch X.

With a little luck, you might have gterm running from an icon....


To get gnome-terminal on the doc, drag the new AppleScript icon to the dock. Clicking the icon should launch a new instance of gnome-terminal. Of course, I do recommend using an alternative icon for your new app. The default OS X terminal app is what I use.



Extra Credit
Chances are you will want to launch gnome-terminal with a command line argument or two. The default "open-x11" does not gracefully handle arguments, but using this open-x11 script, you can pass arguments. I recommend dumping it to /usr/local/bin instead of overwriting the default script. With this modified open-x11, you can now update the AppleScript to something like the following:

do shell script "/usr/local/bin/open-x11 /opt/local/bin/gnome-terminal --show-menubar --geometry=80x50 > /dev/null 2> 1 & "

Labels: , , , , ,

0 Comments:

Post a Comment

<< Home