Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
title_examples [2010-01-21 23:48] asciiphil Page moved and renamed from man:titles to title_examples |
title_examples [2021-02-19 19:49] (current) |
===== Title Examples ===== | ====== Title Examples ====== |
| |
Each screen window has a title. The title is visible in the window display (from the ''[[commands:windows]]'' command or ''[[commands:windows|C-a w]]'') and you can use titles as well as numbers to specify windows for many screen commands. | Each screen window has a title. The title is visible in the window display (from the ''[[commands:windows]]'' command or ''[[commands:windows|C-a w]]'') and you can use titles as well as numbers to specify windows for many screen commands. |
You can set the default title for your windows with the ''[[commands:shelltitle]]'' command in your .screenrc. That may be overridden by the ''-t'' option of the ''[[commands:screen]]'' command, the title-string escape sequence (''<esc>k//<new-title>//<esc>\''), and the ''[[commands:title]]'' command (bound to ''[[commands:title|C-a A]]''). | You can set the default title for your windows with the ''[[commands:shelltitle]]'' command in your .screenrc. That may be overridden by the ''-t'' option of the ''[[commands:screen]]'' command, the title-string escape sequence (''<esc>k//<new-title>//<esc>\''), and the ''[[commands:title]]'' command (bound to ''[[commands:title|C-a A]]''). |
| |
==== Simple examples ==== | ===== Simple examples ===== |
| |
In .screenrc, set the default title of all windows to "cardamom": | In .screenrc, set the default title of all windows to "cardamom": |
| |
| |
==== Setting the title to the host you ssh'd into ==== | ===== Setting the title to the host you ssh'd into ===== |
| |
A nice solution may be found at http://www.tenshu.net/screen_ssh/ | A nice solution may be found at http://www.tenshu.net/screen_ssh/ |
| |
| |
==== Setting the title to the name of the running program ==== | ===== Setting the title to the name of the running program ===== |
| |
A common desire is to name one's windows after the programs running in them. A window sitting at a shell prompt might be named "bash", while one running pine from a shell would be named "pine". | A common desire is to name one's windows after the programs running in them. A window sitting at a shell prompt might be named "bash", while one running pine from a shell would be named "pine". |
<code> | <code> |
alias postcmd 'echo -ne "^[k\!#:0^[\\"' | alias postcmd 'echo -ne "^[k\!#:0^[\\"' |
| </code> |
| |
| On non-Linux systems like (Free)BSD or Solaris you may use the POSIX version with printf: |
| <code> |
| alias postcmd 'printf "\033k\!#\033\\"' |
</code> | </code> |
| |
| |
As a special case, if the //<default-title>// from above ends in a colon, the name of the currently running program will be appended to the default title instead of replacing it. In the above example, with ''shelltitle "$ |bash"'', if you run pine, the title will change from "bash" to "pine", and back to "bash" when you exit pine. If you use ''shelltitle "$ |bash:"'', the title will change from "bash:" to "bash:pine" and then back to "bash:". | As a special case, if the //<default-title>// from above ends in a colon, the name of the currently running program will be appended to the default title instead of replacing it. In the above example, with ''shelltitle "$ |bash"'', if you run pine, the title will change from "bash" to "pine", and back to "bash" when you exit pine. If you use ''shelltitle "$ |bash:"'', the title will change from "bash:" to "bash:pine" and then back to "bash:". |
| |