Gmrun (gnome mishoo's run)

SourceForge Logo

0.9 (tar.gz) [for GTK-2.x] released on Jun 22, 2003.

This tool is a simple "run-program" window, something like "xrun" or "gnome-run". However, those other tools don't have some nice and important features: the very useful feature that allows one to use it with keyboard only, and to be fast enough.

If you saw KDE, it's window manager (KWM) provides a key combination (ALT-F2) that opens such a window. The features there are pretty nice, such as it supports URLs, completion from history, TAB completion for files on the local filesystem, etc.

Because Gnome didn't had such thing, here it is: gmrun, that provides pretty much the same behavior as the KDE's ALT-F2, only it's more configurable.

The piece of software is available under the GNU General Public License.

Features

Here is a list of features provided by this simple and wonderful tool:

  • Provides bash-like TAB completion, only nicer (shows a list containing all possible completions and let the user chose from it; yes, it's also possible to choose with the mouse, but you'll see that the keyboard is outstanding :).
  • Enter simply runs the command line, CTRL-ENTER runs it in a terminal. Of course, the terminal command is configurable in the configuration file, located usually in "~/.gmrunrc".
  • Can run files that do not have "execute" permission :) More specifically, you set a handler for ".doc" files in your .gmrunrc, and it uses that handler to open ".doc" files. [ new in 0.8 ]
  • Maintains a list of previous commands (history). One can interactively search a command in this list using CTRL-R / CTRL-S (something like interactive search in Emacs), or prefixing the command with an exclamation sign "!" -- like in bash, only the user has a chance to see the command before running it, therefore has a chance to change his mind.
  • It has a small window, not bloated with useless buttons and space-wasting things like "gnome-run".
  • Allows URLs (but they have to be configured in the ~/.gmrunrc file). No matter what, if the input string is in the form "whatever://address" then it looks for an URL handler associated with the "whatever" URL and passes to it the "address" string.
  • Allows user to specify a list of commands that will be always run in a terminal, regardless if the fired key is ENTER or CTRL-ENTER.
  • When started, if a history file exists shows the last command as selected text, such as the user can press ENTER directly to run it again or type another text and the old one will be erased.

As far as I remember, I guess that's all; or anyway, these are the features that I use constantly.

Planned future improvements are to make it able to read mail and to browse web pages. Also, it would be nice if it could cook dinner and order beer.

Documentation

Briefly, the documentation has been already written at "Features" chapter :).

Config file

Here is a commented sample of the configuration file:

The following line sets the common terminal options, in a variable named Terminal. This variable's content can be reused, and it's name is not important for gmrun (i.e. could be any name, such as "__console").
Terminal = gnome-terminal --start-factory-server --use-factory
So let's set the variable that shows to gmrun what will the "run-in-terminal" command look like.
TermExec = ${Terminal} -e
The following programs will be always run in terminal, no matter what:
AlwaysInTerm = ssh telnet ftp lynx mc
Set window geometry and position, except height because this is computed dinamically based on your configured font size for GTK+ applications.
Width = 400 Top = 100 Left = 200
Set a maximum size for the history file. Beware that this is in lines, not in bytes.
History = 256
We set this to 1 because we want the last command to be shown selected when the gmrun starts. If set to 0 this wouldn't happen.
ShowLast = 1
Set a timeout (in milliseconds) which when expires will simulate a TAB press. If zero this feature will be disabled (default), which I think is what most users will want. [ new in 0.8 ]
TabTimeout = 0
URL handlers If the entered text is "http://www.google.com" then: -- %u gets replaced with the whole URL ("http://www.google.com") -- %s gets replaced with "//www.google.com". This is useful for URL-s like "man:printf", where %s will get replaced with "printf" Handler for things that start with "http://"
URL_http = mozilla -remote "openURL(%u, new-window)"
This will help us send mail (I tould you I was gonna do that...:)
URL_mailto = mozilla -remote "mailto(%s)"
Easy access to man pages...
URL_man = ${TermExec} 'man %s'
Easy access to directories on the file system (xftree is contained in the XFCE desktop environment, and it's a lightweight and fast file manager).
URL_file = xftree %s
Easy access to README files, usually located in /usr/doc/blah_blah-x.y.z/README, where blah_blah is the program name :)
URL_readme = ${TermExec} 'less /usr/doc/%s/README'
Easy access to info documentation.
URL_info = ${TermExec} 'info %s'
Provides means to run shell commands -- this is not possible dirrectly because gmrun doesn't use system anymore to run commands. So this allows us to ues a URL like: "sh:cd $HOME/foo && make && make install" -- the environment variables are expanded, as well as '~' directoryl; also, the commands are combined with "&&" operator -- that's bash's job, not ours...
URL_sh = sh -c '%s'
I hope it's clear, you can add any URL you like. Only provide the command that handles it. For instance, the following is not present in the default configuration file, but it should be very possible (disclaimer: I didn't test):
URL_MakeSpace = ${TermExec} 'su root -c "userdel -r %s"'
File's extension handlers. In this example we are setting: -- AbiWord to be the default handler for ".doc", ".rtf" files -- emacs to be the handler for most plain-text files -- gv to be the handler for PostScript (".ps") files -- Xpdf for ".pdf" files. [ new in 0.8 ]
EXT:doc,rtf = AbiWord %s EXT:txt,cc,cpp,h,java,html,htm,epl,tex,latex,js,css,xml,xsl,am = emacs %s EXT:ps = gv %s EXT:pdf = xpdf %s
This is it... I forgot to tell you that comments are allowed in the configuration file and they must start with a '#' (it's not enough to be green) -- otherwise bad things may happen! You have been warned.

Keyboard

While running the program, the following keys and key combinations are possible:

ENTER
Of course, this fires the program entered -- in case there is one.
CTRL-ENTER
This combination runs the entered command in a terminal. If no command is there (the input line is empty) then it starts a fresh terminal.
CTRL-R
Starts the "search mode" backward in the history list. The keys pressed in this mode will fire incremental search through history. Pressing CTRL-R again after finding some line will show the next line backward in history that contains the highlighted text.
CTRL-S
The same as the previous, only it searches forward. It is useful only in the middle of an incremental search, when the history prompt is not at the end of the history list, so that if you pressed "CTRL-R" too much times you can go back. This feature misses from bash, I would really need it -- or maybe it's there and I don't know it...
'!' (SHIFT-1)
This is a special key only if pressed as the first character in the input line. It starts a special history search mode where the only lines that match are the ones that start with the entered text. After this mode is started, CTRL-R and CTRL-S can be used as usual but they will only match lines that start with the highlighted text.
TAB
Completes the word at the cursor position. It can complete executables from $PATH; but if the input line starts with a "/" then it will look in the filesystem for some file that matches the input string. Tilda character ('~') is converted to the value of $HOME environment variable, when TAB is pressed. This key cannot complete filenames containing SPACE character (other special characters may also not work, but SPACE is the most important bug right now, probably).

Download

The program is available from SourceForge, in source form and binary for i386. Binaries may not work -- you have been warned.

If there are problems compiling from source please mail me -- I had some reports on this matter; they are usually very easy to fix.

Style config