These commands control the way screen
treats individual windows
in a session. See section Virtual Terminal, for commands to control the
terminal emulation itself.
You can customize each window's name in the window display (viewed with
the windows
command (see section Windows) by setting it with
one of the title commands. Normally the name displayed is the actual
command name of the program created in the window. However, it is
sometimes useful to distinguish various programs of the same name or to
change the name on-the-fly to reflect the current state of the window.
The default name for all shell windows can be set with the
shelltitle
command (see section Shell). You can specify the name you
want for a window with the `-t' option to the screen
command
when the window is created (see section Screen Command). To change the name after
the window has been created you can use the title-string escape-sequence
(ESC k name ESC \) and the title
command
(C-a A). The former can be output from an application to control the
window's name under software control, and the latter will prompt for a
name when typed. You can also bind predefined names to keys with the
title
command to set things quickly without prompting.
title
command.
screen
has a shell-specific heuristic that is enabled by
setting the window's name to search|name and arranging to have a
null title escape-sequence output as a part of your prompt. The
search portion specifies an end-of-prompt search string, while the
name portion specifies the default shell name for the window. If
the name ends in a `:' screen
will add what it
believes to be the current command running in the window to the end of
the specified name (e.g. name:cmd). Otherwise the current
command name supersedes the shell name while it is running.
Here's how it works: you must modify your shell prompt to output a null
title-escape-sequence (ESC k ESC \) as a part of your prompt.
The last part of your prompt must be the same as the string you
specified for the search portion of the title. Once this is set
up, screen
will use the title-escape-sequence to clear the previous
command name and get ready for the next command. Then, when a newline
is received from the shell, a search is made for the end of the prompt.
If found, it will grab the first word after the matched string and use
it as the command name. If the command name begins with `!',
`%', or `^', screen
will use the first word on the
following line (if found) in preference to the just-found name. This
helps csh users get more accurate titles when using job control or
history recall commands.
One thing to keep in mind when adding a null title-escape-sequence to your prompt is that some shells (like the csh) count all the non-control characters as part of the prompt's length. If these invisible characters aren't a multiple of 8 then backspacing over a tab will result in an incorrect display. One way to get around this is to use a prompt like this:
set prompt='<ESC>[0000m<ESC>k<ESC>\% '
The escape-sequence `<ESC>[0000m' not only normalizes the character attributes, but all the zeros round the length of the invisible characters up to 8.
Tcsh handles escape codes in the prompt more intelligently, so you can specify your prompt like this:
set prompt="%{\ek\e\\%}\% "
Bash users will probably want to echo the escape sequence in the PROMPT_COMMAND:
PROMPT_COMMAND='echo -n -e "\033k\033\134"'
(I used `\134' to output a `\' because of a bug in v1.04).
Here are some .screenrc examples:
screen -t top 2 nice top
Adding this line to your .screenrc would start a niced version of the
top
command in window 2 named `top' rather than `nice'.
shelltitle '> |csh' screen 1
This file would start a shell using the given shelltitle. The title specified is an auto-title that would expect the prompt and the typed command to look something like the following:
/usr/joe/src/dir> trn
(it looks after the '> ' for the command name). The window status would show the name `trn' while the command was running, and revert to `csh' upon completion.
bind R screen -t '% |root:' su
Having this command in your .screenrc would bind the key sequence
C-a R to the su
command and give it an auto-title name of
`root:'. For this auto-title to work, the screen could look
something like this:
% !em emacs file.c
Here the user typed the csh history command !em
which ran the
previously entered emacs
command. The window status would show
`root:emacs' during the execution of the command, and revert to
simply `root:' at its completion.
bind o title bind E title "" bind u title (unknown)
The first binding doesn't have any arguments, so it would prompt you for a title when you type C-a o. The second binding would clear an auto-titles current setting (C-a E). The third binding would set the current window's title to `(unknown)' (C-a u).
TIOCCONS
.
exec
command running (see section Exec) then it is killed.
Otherwise the process (e.g. shell) running in the window receives a
HANGUP
condition,
the window structure is removed and screen switches to the previously
displayed window. When the last window is destroyed, screen
exits.
emacs
users may find themselves killing their
emacs
session when trying to delete the current line. For this
reason, it is probably wise to use a different command character
(see section Command Character) or rebind kill
to another key
sequence, such as C-a K (see section Key Binding).
login
command except that the default setting for new
windows is changed. This defaults to `on' unless otherwise specified at
compile time (see section Installation). Both commands are only present when
screen
has been compiled with utmp support.
bind I login on
and bind O
login off
will map these keys to be C-a I and C-a O
(see section Key Binding).
-ln
was
specified for creation. See section Screen Command).
screen
displays a notification in the message line. The
notification message can be redefined by means of the activity
command. Each occurrence of `%' in message is replaced by
the number of the window in which activity has occurred, and each
occurrence of `~' is replaced by the definition for bell in your
termcap (usually an audible bell). The default message is
'Activity in window %'
Note that monitoring is off for all windows by default, but can be altered
by use of the monitor
command (C-a M).
monitor
command except that the default setting for
new windows is changed. Initial setting is `off'.
Screen
maintains a hardstatus line for every window. If a window
gets selected, the display's hardstatus will be updated to match
the window's hardstatus line. If the display has no hardstatus
the line will be displayed as a standard screen message.
The hardstatus line can be changed with the ANSI Application
Program Command (APC): `ESC_<string>ESC\'. As a convenience
for xterm users the sequence `ESC]0..2;<string>^G' is
also accepted.