Previous: Title Prompts, Up: Naming Windows


10.1.4 Setting up shell titles in your .screenrc

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).