[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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.
10.1.1 Title Command | The title command.
| |
10.1.2 Dynamic Titles | Make shell windows change titles dynamically. | |
10.1.3 Setting up your prompt for shell titles | Set up your shell prompt for dynamic Titles. | |
10.1.4 Setting up shell titles in your `.screenrc' | Set up Titles in your `.screenrc'. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
(C-a A)
Set the name of the current window to windowtitle. If no name is
specified, screen prompts for one.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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='No value for esc[0000mNo value for esckNo value for esc\% ' |
The escape-sequence `No value for 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).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated on October, 2 2006 using texi2html 1.76.