Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
title_examples [2007-08-22 11:18]
172.133.110.96
title_examples [2021-02-19 19:49] (current)
Line 1: Line 1:
-===== Titles (naming windows) =====+====== Title Examples ======
  
-Each screen window has a title.  The title is visible in the window display (from the ''windows'' command or ''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 ''shelltitle'' command in your .screenrc.  That may be overridden by the ''-t'' option of the ''screen'' command, the title-string escape sequence (''<esc>k//<new-title>//<esc>\''), and the ''title'' command (bound to ''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":
Line 38: Line 38:
  
  
 +===== Setting the title to the host you ssh'd into =====
  
 +A nice solution may be found at http://www.tenshu.net/screen_ssh/
  
-==== Setting the title to the name of the running program ====+See also http://lists.gnu.org/archive/html/screen-users/2008-07/msg00016.html 
 + 
 + 
 +===== 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".
Line 48: Line 53:
 <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>
  
Line 54: Line 64:
 <code> <code>
 preexec () { preexec () {
-  echo -ne "\ek${(s: :)1}\e\\"+  echo -ne "\ek${1%% *}\e\\"
 } }
 </code> </code>

User Tools