Convenient ssh in Gnome, or 'my sshmenu wish comes true'

May 2, 2009

It turns out that I can get something that more or less does what I wanted sshmenu to do (per yesterday's entry). In email Dan Astoorian pointed me at the Gnome 'Command Line' applet and that it has macro capabilities; you can define a pattern and a command to run (using bits of the pattern) when the pattern matches the 'command' that you type. Thus, you can hijack it into a 'ssh session launcher' with suitable patterns.

The current patterns and commands that I've set up are:

^([a-z0-9.@]*)$ gnome-terminal -e "ssh \1"
^(-.*)$ gnome-terminal -e "ssh \1"
^s (.*)$ gnome-terminal -e "ssh \1"
^r (.*)$ gnome-terminal --terminal-with-profile=RedText -e "ssh root@\1"

(The RedText profile just has a foreground colour of #FF4500 (the classic X 'OrangeRed' colour value) instead of black, so that my root sessions stand out.)

This is actually better than just having a sshmenu text widget that I can type hostnames into, because I get significantly more flexibility. It helps that I already do something similar to this in my regular environment and actually like this peculiar form of mini-commands.

(If I was trying to make Gnome my normal environment I'd put all of the intelligence in a script and just feed all of these patterns to it, because it's much easier to make a script be super-smart than some regular expression matches, but that's too much setup work for what is really supposed to be quick customizations.)

I may well be doing this wrong (although it seems to work) or in a way that could be done better. In the usual Gnome style, the Command Line applet's macro stuff is underdocumented, with specific details about things like macro matching order and the like being notably lacking.

Comments on this page:

From at 2009-05-12 10:23:12:

Any idea if this is available in ubuntu? It's not part of the base install's applet list at least.

By cks at 2009-05-12 12:42:24:

This appears to be an Ubuntu packaging bug. It's a standard part of the gnome-applets source in general, and the Ubuntu gnome-applets package includes a manpage for 'mini_commander_applet' (the binary name), but not the program itself. It's possible that the Ubuntu deskbar-applet could be used as a substitute with some configuration work.

By cks at 2009-05-15 11:09:11:

After some more usage, I've discovered that I want to add '-t "\1"' or the like to most of these entries so that the new terminal window gets a title.

(When doing this with the 'root' entry, it's important to put the -t just before the -e, not before the profile setting; otherwise you get two new terminal windows and a bunch of confusion.)

Written on 02 May 2009.
« My standard Gnome customizations
Why version control systems should support 'rewriting history' »

Page tools: View Source, View Normal, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat May 2 01:56:36 2009
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.