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
appearance [2010-01-23 15:01]
asciiphil
appearance [2021-02-19 20:20] (current)
asciiphil old revision restored (2018-11-03 08:35)
Line 1: Line 1:
-===== screen's Appearance =====+====== screen's Appearance ======
  
-==== Basics ====+===== Basics =====
  
-==== Extras ====+The commands in this section include things that allow ''screen'' to 
 +communicate information to the user (like the ''[[commands:info]]'' 
 +command) and things that change how ''screen'' looks (like the 
 +''[[commands:caption]]'' command).
  
-hardstatus and caption+The information-providing commands are pretty simple: 
 +''[[commands:info|C-a i]]'' gives some information about the current 
 +window; ''[[commands:time|C-a t]]'' displays some information about the 
 +system on which ''screen'' is running (including the current time); 
 +''[[commands:lastmsg|C-a m]]'' redisplays the last message that ''screen'' 
 +displayed (in case you missed it); ''[[commands:version|C-a v]]'' displays 
 +information about the version of ''screen'' that's running; and 
 +''[[commands:license|C-a ,]]'' displays the license information screen 
 +that is shown at ''screen'' startup by default.
  
-Note about ''fit''.+===== Extras =====
  
-Describe ''info''.+==== Hardstatus Lines ====
  
-==== Command Line ====+Some terminals, mostly hardware serial terminals, have a separate area of 
 +their display that is reserved as a status line. Many modern graphical 
 +terminals use the titlebar of the window for such status information. 
 +''screen'' calls this a 
 +"hardstatus line" When ''screen'' starts, it checks to see if the 
 +''hs'' termcap capability is set; if so, it assumes that there's a 
 +hardstatus line present.  If there's a hardstatus line and the 
 +''[[commands:hardstatus]]'' option is set to "on" (which is the default 
 +setting), ''screen'' will use the hardstatus line to display status 
 +messages.
  
-  * ''-A'' - Disables one aspect of screen's default behavior: If the terminal can be resized, then screen will resize the terminal to fit the dimensions of the windows it's displaying.  When ''-A'' is givenresizable terminals work just like nonresizable terminals--the windows are resized to fit the dimensions of the display.  (See below for Windows PuTTY)+''screen'' also advertises the hardstatus capability to programs running 
 +in its windows.  When a program uses the hardstatus escape sequence 
 +(''ESC_//string//ESC\'') or the ''xterm'' title escape sequence 
 +(''ESC]0;//string//^G'')''screen'' stores that //string// on a 
 +per-window basis.  The per-window hardstatus string can also be changed 
 +with the ''[[commands:hstatus]]'' command (and the default hstatus for new 
 +windows can be set with ''[[commands:defhstatus]]'').
  
-==== Keybindings ====+The ''[[commands:hardstatus]]'' command can also be used to set a string 
 +that will be displayed in the hardstatus line when ''screen'' isn't using 
 +it to display messages.  The string can contain any of ''screen'''
 +[[man:string escapes]].  The default value is ''%h'', which just displays 
 +the current window's hstatus string.
  
-  * ''C-a C'' - (''[[commands:clear]]'' Clears the current window. +==== Status Bar ==== 
-  * ''C-a F'' - (''[[commands:fit]]'' Fits the current window to the display's dimensions.+ 
 +One of the most common things that ''screen'' users want to do is to have 
 +some sort of status bar at the bottom (or top) of the display.  ''screen'' 
 +provides several ways to do this. 
 + 
 +If your terminal has a hardstatus line (as discussed above), you can use 
 +the ''[[commands:hardstatus]]'' string as a status bar.  If you don't have 
 +a hardstatus line, you have two choices.  The first is to use the command 
 +''[[commands:hardstatus]] lastline'', which tells ''screen'' to reserve 
 +the last line of the display for use as a hardstatus line.  With a 
 +''[[commands:hardstatus]] string //param//'' command, you will get a 
 +status bar at the bottom of your display. 
 + 
 +The second option is to use the ''[[commands:caption]]'' command.  When 
 +the display is split into multiple regions (see [[Region Management]] for 
 +more details), ''screen'' puts a caption at the bottom of each region. 
 +You can use the ''[[commands:caption]] always'' command to always display 
 +the caption, even if the display is not split.  Just as with 
 +''[[commands:hardstatus]]'', there's a ''[[commands:caption]] string 
 +//param//'' command that can be used to make a status bar.  It uses all 
 +the same [[man:string escapes]] that the ''[[commands:hardstatus]]'' 
 +command does. 
 + 
 +There are tradeoffs for each of the two approaches.  One big one is that 
 +it's common to (ab)use the hardstatus capability to 
 +[[faq#how_can_screen_use_xterm_s_title_bar|put things into ''xterm'''
 +title bar]].  If you plan to do that, you'll need to use the caption for 
 +your status bar.  Another tradeoff is that you might want different 
 +information available in the captions for split displays than in your main 
 +status bar.  In that case, you'd want to use the hardstatus line for the 
 +status bar. 
 + 
 +==== Bells ==== 
 + 
 +''screen'' can either use an audible bell or a visual bell, as controlled 
 +by the ''[[commands:vbell]]'' command.  If ''[[commands:vbell]]'' is off, 
 +when ''screen'' receives an ASCII BEL character in the current window, it 
 +sends a bell character (usually an ASCII BEL, but it depends on what the 
 +terminal's termcap says) to the display (which will, presumably, beep). 
 +If ''[[commands:vbell]]'' is on, when ''screen'' receives a BEL character, 
 +it either triggers the display terminal's visual bell, if the terminal'
 +termcap has a ''vb'' capability, or it flashes the screen and displays the 
 +''[[commands:vbell_msg]]'' ''[[commands:vbell|C-a C-g]]'' will toggle 
 +''[[commands:vbell]]'' on and off. 
 + 
 +If ''screen'' receives a bell in a window other than the current one, it 
 +displays the ''[[commands:bell_msg]]'' onscreen. 
 + 
 +==== Window Size ==== 
 + 
 +A ''screen'' window does not have to be the same size as the display 
 +that's connected to it, although ''screen'' will resize windows to the 
 +display when you switch to them.  This only applies to the first display 
 +showing the window; if another connected display, either from the ''-x'' 
 +[[man:Command-Line Options|command-line option]] or from a [[:multiuser]] 
 +session, switches to an already-displayed window, the window keeps the 
 +size set by the first display. 
 + 
 +The ''[[commands:height]]'' command can change either the height or the 
 +height and width of a window.  (If you want to just change the width, use 
 +the ''[[commands:width]]'' command, which is exactly like 
 +''[[commands:height]]'' with the arguments reversed.)  If the display'
 +termcap supports it, screen will change both the display terminal's and 
 +the current window's dimensions.  You can specify changing just the 
 +display or just the window with the ''-d'' and ''-w'' options, 
 +respectively. 
 + 
 +If a window's dimensions have gotten out of sync with a display's, you can 
 +use the ''[[commands:fit|C-a F]]'' command to resize the window to the 
 +display. 
 + 
 + 
 +===== Command Line ===== 
 + 
 +  * ''-A'' - Disables one aspect of screen's default behavior: Normally, if the terminal can be resized, then screen will resize the terminal to fit the dimensions of the windows it's displaying.  When ''-A'' is given, resizable terminals work just like nonresizable terminals--the windows are resized to fit the dimensions of the display.  (See below for Windows PuTTY) 
 + 
 +===== Keybindings ===== 
 + 
 +  * ''C-a C''   - (''[[commands:clear]]'' Clears the current window. 
 +  * ''C-a F''   - (''[[commands:fit]]'' Fits the current window to the display's dimensions.
   * ''C-a C-g'' - (''[[commands:vbell]]'' Toggles visual bell mode.   * ''C-a C-g'' - (''[[commands:vbell]]'' Toggles visual bell mode.
-  * ''C-a i'' - (''[[commands:info]]'' Displays information about the current window. +  * ''C-a i''   - (''[[commands:info]]'' Displays information about the current window. 
-  * ''C-a C-i'' - (''[[commands:info]]'' Alternate keybinding. +  * ''C-a m''   - (''[[commands:lastmsg]]'' Redisplays the last message for this display. 
-  * ''C-a C-m'' - (''[[commands:lastmsg]]'' Redisplays the last message for this display. +  * ''C-a t''   - (''[[commands:time]]'' Displays system information. 
-  * ''C-a t'' - (''[[commands:time]]'' Displays system information+  * ''C-a v''   - (''[[commands:version]]'' Displays screen's version information. 
-  * ''C-a C-t'' - (''[[commands:time]]'' Alternate keybinding+  * ''C-a W''   - (''[[commands:width]]'' Toggles the display between 80 and 132 columns. 
-  * ''C-a v'' - (''[[commands:version]]'' Displays screen's version information. +  * ''C-a ,''   - (''[[commands:license]]'' Displays screen's license information.
-  * ''C-a W'' - (''[[commands:width]]'' Toggles the display between 80 and 132 columns. +
-  * ''C-a ,'' - (''[[commands:license]]'' Displays screen's license information.+
  
-==== Commands ====+===== Commands =====
  
   * ''[[commands:attrcolor]]'' - Remaps the effect of text attributes.   * ''[[commands:attrcolor]]'' - Remaps the effect of text attributes.
-  * ''[[commands:autonuke]]'' - Determines whether a given window will sttempt to display beffered text after a clear command is received.+  * ''[[commands:autonuke]]'' - Determines whether a given window will attempt to display buffered text after a clear command is received.
   * ''[[commands:bell_msg]]'' - Changes the message printed when a bell character is received in another window.   * ''[[commands:bell_msg]]'' - Changes the message printed when a bell character is received in another window.
   * ''[[commands:caption]]'' - Controls the display of the caption line at the bottom of screen windows.   * ''[[commands:caption]]'' - Controls the display of the caption line at the bottom of screen windows.
Line 59: Line 166:
   * ''[[commands:width]]'' - Like ''[[commands:height]]'', but with the order of arguments reversed.   * ''[[commands:width]]'' - Like ''[[commands:height]]'', but with the order of arguments reversed.
  
-==== Examples ====+===== Examples =====
  
 +==== Status Bar Examples ====
  
-Change the color to bright red if bold text is to be printed:+=== Simple window list === 
 + 
 +You can force the status line to always stay at the bottom of the screen 
 +and set up a statusline string that displays the window information by 
 +adding either of these to your .screenrc:
  
 <code> <code>
-attrcolor b "R"+hardstatus alwayslastline "%w"
 </code> </code>
  
-Use blue text instead of underline:+<code> 
 +caption always "%w" 
 +</code> 
 + 
 +=== Highlighted current window === 
 + 
 +This puts the current window in bold and surrounded by brackets:
  
 <code> <code>
-attrcolor u "-b"+caption always "%{-b ..}%-w%{+b ..}[[%n%f*%t]]%{-}%+w"
 </code> </code>
  
-Use bright colors for bold text.  Most terminal emulators do this already:+=== Window list centered on current window === 
 + 
 +See the examples in [[truncation/padding escapes]], particularly the last 
 +example. 
 + 
 +=== Centered window list === 
 + 
 +This small snippet for your .screenrc uses both the caption and hardstatus 
 +line to give a two-line statusbar at the bottom of the display.  The upper 
 +line (the caption line) consists of the number and name of all open 
 +windows, black on white background, with the active window centered and 
 +highlighted.  The lower line (the hardstatus line) shows the window 
 +number, window name and the window's hardstatus in white on black.
  
 <code> <code>
-attrcolor b ".I"+hardstatus alwayslastline "%= %3n %t%? [%h]%? %=" 
 +caption always "%= %-w%L>%{= BW}%n*%t%{-}%52<%+w %L="
 </code> </code>
  
-Make bright colored text also bold:+=== Status bar and xterm title === 
 + 
 +In this section, we'll build up a configuration that uses the ''xterm'' 
 +title bar as a hardstatus line and displays a status bar at the bottom of 
 +the screen. 
 + 
 +To start with, we'll tell screen that ''xterm''s (and some other terminals 
 +that use the same escape sequences) do have a hardstatus line, and we'll 
 +use the escape sequences for setting the title bar as the hardstatus 
 +escape sequences:
  
 <code> <code>
-attrcolor i "+b"+termcapinfo xterm*|Eterm|mlterm "hs:ts=\E]0;:fs=\007:ds=\E]0;screen\007"
 </code> </code>
  
-=== Always display window list ===+Title bars aren't good places for actual status messages, so we'll tell 
 +screen not to use the hardstatus line for status messages (they'll be 
 +displayed at the bottom of the screen, just as if there was no hardstatus 
 +line): 
 + 
 +<code> 
 +hardstatus off 
 +</code>
  
-You can force the status line to always stay at the bottom of the screen and set up a statusline string that displays the window information by adding this to your .screenrc:+We'll set the hardstatus string to show us the number and title of the 
 +current window, as well as the window's hstatus string Because of the 
 +''%?'' escapes, the brackets are only shown if the window has an hstatus 
 +string:
  
 <code> <code>
-hardstatus on +hardstatus string "screen %n (%t)%? [%h]%?"
-hardstatus alwayslastline +
-hardstatus string "%w"+
 </code> </code>
  
-=== Fancy statusbar with centered window list ===+Finally, we have the caption that makes for our status bar at the bottom 
 +of the screen.  It makes use of the ''%F'' escape to change the colors 
 +depending on whether it's attached to the window with the focus.  This 
 +causes the currently-focused window to stand out.
  
-This small snippet for your .screenrc gives you two-line statusbar at the bottom of the screen. The upper line consists of the number and name of all open windowsblack on white background, with the active window centered and highlighted. The lower line shows the window number, window name and the window's hardstatus in white on black.+If the caption is on non-focused window, the entire bar is blue text on 
 +a blue background (so it just looks blue), with the exception of the 
 +window's information, which is blue on yellow The focused (or only) 
 +window's caption has a blue-on-cyan information section with the date and 
 +computer name, followed by the window list in white on blue The current 
 +window is centered in the window list and is displayed in blue on yellow:
  
 <code> <code>
-altscreen on  +caption always "%?%F%{-b bc}%:%{-b bb}%?%C|%D|%M %d|%H%?%F%{+u wb}%? %L=%-Lw%45>%{+b by}%n%f*%t%{-}%+Lw%-0<"
-hardstatus on +
-hardstatus alwayslastline +
-hardstatus string "%%3n %t%? [%h]%? %=" +
-caption always +
-caption string "%= %-w%L>%{= BW}%n*%t%{-}%52<%+%L="+
 </code> </code>
  
-==== Screen resizing despite -A when using PuTTY on Windows ====+===== Screen resizing despite -A when using PuTTY on Windows, iTerm2 on Mac OS X =====
  
 With GNU ''screen'' 2009-05-15 ([[git://git.savannah.gnu.org/screen.git]] :: 9cdf8e20), the resize disable command line option ''-A'' does not work with PuTTY on Windows (0.60). One way to work around this is to disable the terminal feature for remote-controlled terminal resizing in PuTTY. This setting is found in "Terminal" > "Features" > "Disable remote-controlled terminal resizing". After this you do not need to specify ''-A'' since ''screen'' will now force a resizing. With GNU ''screen'' 2009-05-15 ([[git://git.savannah.gnu.org/screen.git]] :: 9cdf8e20), the resize disable command line option ''-A'' does not work with PuTTY on Windows (0.60). One way to work around this is to disable the terminal feature for remote-controlled terminal resizing in PuTTY. This setting is found in "Terminal" > "Features" > "Disable remote-controlled terminal resizing". After this you do not need to specify ''-A'' since ''screen'' will now force a resizing.
 +
 +The same problem occurs with iTerm 2 on Mac OS X, and the solution is approximately the same: in your profile, select the ''terminal'' tab, then mark the checkbox ''Disable session-initiated window resizing''.
  

User Tools