Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#8 (patch 4 of 4) launch a viewing program

Rob McMullen

Enhancement: launch a viewing program when filenames
are clicked in a directory listing that appears on
screen. The setup for this is that your shell has to
print out a new escape sequence every time you change
directories, and rxvt keeps track of what directory
goes with what line on the screen (or in the scrollback
buffer). An external script is launched with the path
and file as arguments, and the script can then
determine the file type and exec an appropriate viewing
program. A side effect of this enhancement is that it
also allows a shift+left click to extend selections.

Configure option:


Not a default option, either. There are a few other
things that must be set up correctly for this to work,
described below.

Command line switch/resource:

*launchProg: (filename) (or [-launcher filename] from
the command line)

The name of the executable (e.g. a script) to use
as a middleman to decide what viewer to launch for the
path and file sent to it as arguments.

*launchRightClick: (boolean)

Launch the filename if clicked once with the right
mouse button.

*launchDoubleClick: (boolean)

Launch the filename if double-clicked (with the
left mouse button). Using this one (versus the right
click) causes a slight delay because rxvt has to decide
that you didn't mean to continue to select stuff with
the left mouse button. Only after the double click
happened fast enough *and* you've released the mouse
button soon enough after the final click will it go
with the launch.

Extra stuff:

Note that both launchRightClick and launchDoubleClick
can be enabled at the same time. Dunno why you'd do
that, but let's call it a feature.

You need to have an executable somewhere (typically a
shell script) that will decide which viewer/editor
program to launch given a path and filename sent to it
by rxvt. Here's a sample script that I use. I call it
rxvtrun.sh, put it in my path somewhere, and set my
this in my ~/.Xdefaults:

Rxvt*launchProg: rxvtrun.sh

I'll include this disclaimer on all of these patches
just to make sure that the source code remains GPL'd.
It is Copyright (c) 2003 Rob McMullen
<robm@flipturn.org>, licensed under the GNU General
Public License (version 2 or later).


  • Rob McMullen
    Rob McMullen

    patch against current rxvt-cvs (as of 18 Jan 03)

  • Rob McMullen
    Rob McMullen

    script to be edited for your prefs and installed in your path

  • Logged In: NO

    The person who wrote this comment needs to learn how to use a file manager. See: dfm, xfm, nautilus, or mc.