xcmd(1x)

NAME

xcmd - front-end for starting programs under X11

SYNOPSIS

(1) xcmd --help

(2) xcmd [--display display] [find-options] --xcmd command

(3) xcmd [--display display] [find-options] [term-options] --cmd command

  Find Options
--find-class window-class
--find-resource window-resource
--find-substr title-substring
--find-title window-title
{--iconify-and-raise | --only-raise}

  Terminal Window Options
--title window-title
--icon icon-title
--name window-resource
--geometry window-geometry
--opt additional-options
{--scroll | +scroll}
{--rxvt | --xterm}

DESCRIPTION

Xcmd is a front-end for starting programs under X11. You can tell xcmd to look for a window with a specific class, resource name, or title string (using the --find-property options); if it finds one or more, xcmd will `raise' them, otherwise it will run the command you specify. You can tell xcmd to run commands that create their own windows (using --xcmd), or to run commands inside a terminal window (using --cmd) with various options.

OPTIONS

-h or --help
    Display version information and a summary of command syntax.

-d or --display display
    This option allows you to specify the server to connect to; see X(3x).

-c or --cmd command
    Run command in a terminal window (see Terminal Window Options below). If you use one of the --find-property options, xcmd only runs command if it can't find a window with that property.

-x or --xcmd command
    Run command, with the expectation that it will create its own window. If you use one of the --find-property options, xcmd only runs command if it can't find a window with that property.

  Find Options

The following options tell xcmd to search the display for a window that has the specified property. If xcmd finds one or more such windows, it raises them to the top of the display. These options are mutually exclusive.

-fc or --find-class window-class
    Find windows whose class matches window-class exactly.

-fr or --find-resource window-resource
    Find windows whose resource name matches window-resource exactly.

-fs or --find-substr title-substring
    Find windows whose title contains the string title-substring.

-ft or --find-title window-title
    Find windows whose title matches window-title exactly.

-ir or --iconify-and-raise
    When xcmd finds a window, first iconify it, then raise it; this `flashes' a little, but it works reliably under FVWM with different X server loads. It doesn't work reliably with WindowMaker.

-or or --only-raise
    When xcmd finds a window, just raise it. This doesn't `flash', but it also doesn't always work with FVWM. It does work reliably with WindowMaker, as long as the window is in the current workspace. This is the default.

  Terminal Window Options

The following options control the appearance of the terminal window created when you run a command with --cmd. Xcmd gives an error if you use any of these options without using --cmd.

-t or --title window-title
    The title to give the terminal window. If you don't specify this option, the title reverts to the resource name (see --name) if one is specified, otherwise it reverts to command.

-i or --icon icon-title
    The title to give to the terminal window when it's iconified. If you don't specify this option, the icon title reverts to the window title.

-n or --name window-resource
    The resource name to give the terminal window. If you don't specify this option, it reverts to the default resource name for the terminal program (e.g., `xterm' for xterm(1x)).

-g or --geometry window-geometry
    The geometry to use for the terminal window. If you don't specify this option, it reverts to the default for the terminal program.

-o or --opt additional-options
    Additional options to pass to the terminal program; additional-options should be one argument---you may need to quote it using your favorite shell's regular syntax.

-s/+s or --scroll/+scroll
    Use (--scroll) or don't use (+scroll) a scrollbar in the terminal window. If you don't specify either of these options, whether the terminal uses a scrollbar depends on its defaults and its X resource settings.

-rt/-xt or --rxvt/--xterm
    Use rxvt(1x) or xterm(1x) as the terminal program to run command in. Normally, xcmd uses the terminal program specified in the XCMD_TERM environment variable (see ENVIRONMENT below), or xterm(1x) if that variable is not set. These options override the default setting.

EXAMPLES

Here are some examples of how to use xcmd:

xcmd --cmd vi
    Run vi in a terminal window.

xcmd --cmd 'vi ~/.Xdefaults'
    Run vi in a terminal window and edit ~/.Xdefaults.

xcmd --find-resource 'Navigator' --xcmd netscape
    Look for a Netscape window, or start one if none found.

xcmd --find-title 'Network Configurator' --xcmd 'sudo netcfg'
    Look for a window titled Network Configurator; if none found, use sudo to start netcfg.

xcmd --find-title Mail --cmd pine --title Mail --name xMail +scroll
    Look for a window titled Mail; if none found, start pine in a terminal window titled Mail, with a resource name of xMail and no scrollbar. If the X resource `*xMail*vt100.geometry: 80x40' is set, for instance, the resulting window will be 80 columns wide by 40 lines high.

NOTES

Xcmd uses an execl(3) call to run /bin/sh -c exec command, so that command inherits xcmd's process ID. Xcmd runs in the foreground by default; use your favorite shell's regular syntax to start xcmd in the background (e.g., `xcmd --find-title vi --cmd vi &' for Bourne-compatible shells).

ENVIRONMENT

DISPLAY
    To get the default host and display number.

XCMD_TERM
    To set the default terminal program to use with --cmd. Overridden by the command line.

XCMD_ICONIFY
    If set to `0', `no', or `false', act as if the command-line option --only-raise was specified (this is the default if not set). If set to `1', `yes', or `true', act as if the command-line option --iconify-and-raise was specified. Any other value produces an error message. XCMD_ICONIFY is overridden by the command line.

SEE ALSO

X(3x), rxvt(1x), xterm(1x), xwininfo(1x)

AUTHOR

Jim Knoble <jmknoble@pobox.com>

Xcmd is very loosely derived from portions of xwit by Mark Martin and David DiGiacomo and xwininfo by Mark Lillibridge. Almost none of the original code remains.