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 [2006-06-25 22:18]
84.61.132.197
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.+''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'' - (''clear'' Clears the current window. +==== Status Bar ====
-  * ''C-a F'' - (''fit'' Fits the current window to the display's dimensions. +
-  * ''C-a C-g'' - (''vbell'' Toggles visual bell mode. +
-  * ''C-a i'' - (''info'' Displays information about the current window. +
-  * ''C-a C-i'' - (''info'' Alternate keybinding. +
-  * ''C-a C-m'' - (''lastmsg'' Redisplays the last message for this display. +
-  * ''C-a t'' - (''time'' Displays system information. +
-  * ''C-a C-t'' - (''time'' Alternate keybinding. +
-  * ''C-a v'' - (''version'' Displays screen's version information. +
-  * ''C-a W'' - (''width'' Toggles the display between 80 and 132 columns. +
-  * ''C-a ,'' - (''license'' Displays screen's license information.+
  
-==== Commands ====+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.
  
-  * ''attrcolor //attrib// [//attribute/color-modifier//]'' - Remap the effect of text attributes.  A listing of attributes can be found in [[string escapes]].  This command tells screen that when the attribute //attrib// is encountered, it should instead be treated as if //attribute/color-modifier// were in its place.  The replacement is only done once.  The modifiers may include ''i'' and ''I'', which represent, respectively, high-intensity foreground color (bold foreground) and high-intensity background color (bold background). +If your terminal has a hardstatus line (as discussed above)you can use 
-  * ''autonuke on|off'' - Per-window setting.  If autonuke is on and screen gets a command to clear the window while it still has text buffered that has not been sent to the window, it will just discard that text without ever sending it.  The default value is set by defautonuke. +the ''[[commands:hardstatus]]'' string as a status bar.  If you don't have 
-  * ''bell_msg [//message//]'' - Changes the message printed when bell character is received in another window.  In addition to the normal [[string escapes]]if a ^G is in the string then screen will send a bell character to the current window.  The default value is "Bell in window %n" If an empty string is supplied, no message will be shown.  If no parameter is supplied, the current value will be displayed. +hardstatus line, you have two choices.  The first is to use the command 
-  * ''caption always|splitonly [//string//]'' - Controls the display of the caption line at the bottom of screen windows.  ''always'' means that the caption is always visible.  ''splitonly'' means that the caption only appears when the display is split into multiple windows.  If //string// is supplied, it also changes the string used for the captions; it can contain [[string escapes]].  The default setting is ''splitonly'', and the default string is "%3n %t". +''[[commands:hardstatus]] lastline'', which tells ''screen'' to reserve 
-  * ''caption string [//string//]'' - Used for changing the caption string without changing the rules for when it's displayed.  If no parameter is supplied, the current string will be displayed. +the last line of the display for use as a hardstatus line.  With 
-  * ''clear'' - Clears the current window, but puts its text into the scrollback buffer. +''[[commands:hardstatus]] string //param//'' commandyou will get 
-  * ''defautonuke on|off'' - Changes the default autonuke setting for new windows.  The default value is ''off''+status bar at the bottom of your display.
-  * ''defhstatus [//status//]'' - Sets the default hardstatus line for new windows.  With no parameterdisplays the current value.  The default value is an empty string. +
-  * ''echo [-n] //message//'' - Displays //message// on the current display as if it were a screen message.  Doesn't support string escapes, but will evaluate environment variables.  [//The man page says that -n "may be used to suppress the line feed", but I can't see a line feed, and as far as I can tell the -n option does nothing.  <PMG>//] +
-  ''fit'' - Resizes the window to fit the current display region.  Useful if the window wasn't resized automatically (either because resizing was turned off or because the window was displayed on another terminal at the same time). +
-  * ''height [-w|-d] [//lines// [//cols//]]'' - If ''-w'' is specifiedchanges the dimensions of the window.  If ''-d'' is specified, changes the dimensions of the display.  The default is ''-d'' If no dimensions are specified, the command toggles between 24 lines and 42 lines, leaving the number of columns unchanged. +
-  * ''info'' - Display information about screen and the current window in the message area. +
-  * ''license'' - Displays screen's license, as happens when screen starts up. +
-  * ''nethack on|off'' - If ''on'', screen's error and information messages become sillier and more nethack-like.  The default value is ''off'' Can also be influenced by the $NETHACKOPTIONS environment variable.  [//In past versions of screen, at least, it defaulted to ''on'' if ~/.nethackrc existed.  Has this been removed?  <PMG>//] +
-  * ''hardstatus [on|off]'' - Sets or toggles use of the terminal's hardstatus line (if any) for displaying screen messages.  The default value is ''on''+
-  * ''hardstatus [always]lastline|message|ignore [//string//]'' - Sets screen's behavior for displaying messages when the terminal has no hardstatus line.  ''lastline'' reserves a line at the bottom of the display for the messages.  ''alwayslastline'' is the same, but does it even if the terminal actually has a hardstatus line elsewhere.  ''message'' uses screen's messaging display for hardstatus text.  ''ignore'' causes screen to never display hardstatus text.  If //string// is supplied, this also sets the hardstatus string.  [//What's the default?  <PMG>//+
-  * ''hardstatus string [//string//]'' - Sets the hardstatus string for the current window or displays the current string if no argument is given.  The default value is "%h" +
-  * ''hstatus //status//'' - Synonym for ''hardstatus string //status//''+
-  * ''lastmsg'' - Redisplays the last message that screen showed on the current display. +
-  * ''msgminwait //sec//'' - Sets the minimum length of time, in seconds, that screen message will be visible even if the user interacts with screen.  The default value is 1 second. +
-  ''msgwait //sec//'' - Sets the length of time, in seconds, that a message will remain visible if the user does not interact with screen during the lifetime of the message.  The default value is 5 seconds. +
-  * ''sorendition [//attr// [//color//]]'' - Defines the visual appearance of screen's messages using the attribute definitions from the [[string escapes]] page.  If no arguments are given, the current settings are shown.  [//Though not in the same format that they're entered.  <PMG>//]  The default value is "=s dd" (standout, with default colors). +
-  * ''startup_message on|off'' - Enables or disables the display of screen's license information when screen starts up.  The default value is ''on''+
-  * ''time [//string//]'' - With no argumentsuses the message display to display information about the system.  If //string// is supplied, sets the string displayed when ''time'' is run with no arguments using sequences from [[string escapes]].  The default value is "%c:%s %M %d %H%? %l%?" (time, date, hostname, system load). +
-  * ''vbell [on|off]'' - Sets or toggles the visual bell.  When ''on'', the bell character causes the screen to flash and message to appear.  When ''off'', causes the terminal to receive a bell character.  The default value is ''off''. +
-  * ''vbell_msg [//message//]'' - Sets or displays the message displayed for visual bells.  The default value is "Wuff, Wuff!!"+
-  * ''vbellwait //sec//'' - Defines a hysteresis for visual bells; if multiple bell characters are received less than //sec// seconds apart, the visual bell behavior will only be activated once.  The default value is 1 second. +
-  * ''version'' - Uses the message area to display screen's version and compile date. +
-  * ''wall //message//'' - Like ''echo'', but sends the message to all displays, with the name of the current user prepended. +
-  * ''width [-w|-d] [//cols// [//lines//]]'' - Like ''height'', but with the order of arguments reversed.  If //cols// is not supplied, the width is toggeled between 80 and 132 columns. +
-==== Examples ====+
  
 +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.
  
-              attrcolor b "R"+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.
  
-Change the color to bright red if bold text is to be printed.+==== Bells ====
  
-              attrcolor u "-u b"+''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.
  
-Use blue text instead of underline.+If ''screen'' receives a bell in a window other than the current one, it 
 +displays the ''[[commands:bell_msg]]'' onscreen.
  
-              attrcolor b ".I"+==== Window Size ====
  
-Use bright colors for  bold  text.  Most  terminal  emulators  do +A ''screen'' window does not have to be the same size as the display 
-this already.+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.
  
-              attrcolor i "+b"+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.
  
-Make bright colored text also bold.+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.
  
  
-=== Always display window list === +===== Command Line =====
-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:+
  
-   hardstatus on +  * ''-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)
-   hardstatus alwayslastline +
-   hardstatus string "%w"+
  
 +===== Keybindings =====
  
-=== Fancy statusbar with centered window list === +  * ''C-a C''   - (''[[commands:clear]]'' Clears the current window. 
-This small snippet gives you two-line statusbar at the bottom of the screenThe upper line consists of the number and name of all open windows, black on white background, with the active window centered and highlightedThe lower line shows the window number, window name and the window'hardstatus in white on black.+  * ''C-F''   (''[[commands:fit]]'' Fits the current window to the display's dimensions. 
 +  * ''C-a C-g'' - (''[[commands:vbell]]'' Toggles visual bell mode. 
 +  * ''C-a i''   - (''[[commands:info]]'' Displays information about the current window. 
 +  * ''C-a m''   - (''[[commands:lastmsg]]'' Redisplays the last message for this display. 
 +  * ''C-a t''   - (''[[commands:time]]'' Displays system information. 
 +  * ''C-a v''   - (''[[commands:version]]'' Displays screen's version information. 
 +  * ''C-a W''   - (''[[commands:width]]'' Toggles the display between 80 and 132 columns. 
 +  * ''C-a ,''   - (''[[commands:license]]'' Displays screen'license information.
  
-   altscreen on  +===== Commands ===== 
-   hardstatus on + 
-   hardstatus alwayslastline +  * ''[[commands:attrcolor]]'' - Remaps the effect of text attributes. 
-   hardstatus string "%= %3n %t%? [%h]%? %=" +  * ''[[commands:autonuke]]'' - Determines whether a given window will attempt to display buffered text after a clear command is received. 
-   caption always +  * ''[[commands:bell_msg]]'' - Changes the message printed when a bell character is received in another window. 
-   caption string "%= %-w%L>%{= BW}%n*%t%{-}%52<%+w %L="+  * ''[[commands:caption]]'' - Controls the display of the caption line at the bottom of screen windows. 
 +  * ''[[commands:clear]]'' - Clears the current window, but puts its text into the scrollback buffer. 
 +  * ''[[commands:defautonuke]]'' - Changes the default ''[[commands:autonuke]]'' setting for new windows. 
 +  * ''[[commands:defhstatus]]'' - Sets the default hardstatus line for new windows. 
 +  * ''[[commands:echo]]'' - Displays a message on the current display as if it were a screen message. 
 +  * ''[[commands:fit]]'' - Resizes the window to fit the current display region. 
 +  * ''[[commands:height]]'' - Changes the dimensions of the window or the display. 
 +  * ''[[commands:info]]'' - Display information about screen and the current window in the message area. 
 +  * ''[[commands:license]]'' - Displays screen's license, as happens when screen starts up. 
 +  * ''[[commands:nethack]]'' - Controls the use of nethack-themed messages from ''screen''
 +  * ''[[commands:hardstatus]]'' - Controls use of the terminal's hardstatus line (if any) for displaying screen messages. 
 +  * ''[[commands:hstatus]]'' - Synonym for ''[[commands:hardstatus]] string //status//''
 +  * ''[[commands:lastmsg]]'' - Redisplays the last message that screen showed on the current display. 
 +  * ''[[commands:msgminwait]]'' - Sets the minimum length of time that a screen message will be visible even if the user interacts with screen. 
 +  * ''[[commands:msgwait]]'' - Sets the length of time that a message will remain visible if the user does not interact with screen during the lifetime of the message. 
 +  * ''[[commands:sorendition]]'' - Defines the visual appearance of screen's messages. 
 +  * ''[[commands:startup_message]]'' - Enables or disables the display of screen's license information when screen starts up. 
 +  * ''[[commands:time]]'' - Displays (or controls the display of) system information. 
 +  * ''[[commands:vbell]]'' - Sets or toggles the visual bell. 
 +  * ''[[commands:vbell_msg]]'' - Sets or displays the message displayed for visual bells. 
 +  * ''[[commands:vbellwait]]'' - Defines a hysteresis for visual bells. 
 +  * ''[[commands:version]]'' - Uses the message area to display screen's version and compile date. 
 +  * ''[[commands:wall]]'' - Like ''[[commands:echo]]'', but sends the message to all displays, with the name of the current user prepended. 
 +  * ''[[commands:width]]'' - Like ''[[commands:height]]'', but with the order of arguments reversed. 
 + 
 +===== Examples ===== 
 + 
 +==== Status Bar Examples ==== 
 + 
 +=== 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> 
 +hardstatus alwayslastline "%w" 
 +</code> 
 + 
 +<code> 
 +caption always "%w" 
 +</code> 
 + 
 +=== Highlighted current window === 
 + 
 +This puts the current window in bold and surrounded by brackets: 
 + 
 +<code> 
 +caption always "%{-b ..}%-w%{+b ..}[[%n%f*%t]]%{-}%+w" 
 +</code> 
 + 
 +=== 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> 
 +hardstatus alwayslastline "%= %3n %t%? [%h]%? %=" 
 +caption always "%= %-w%L>%{= BW}%n*%t%{-}%52<%+w %L=" 
 +</code> 
 + 
 +=== 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> 
 +termcapinfo xterm*|Eterm|mlterm "hs:ts=\E]0;:fs=\007:ds=\E]0;screen\007" 
 +</code> 
 + 
 +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> 
 + 
 +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> 
 +hardstatus string "screen %n (%t)%? [%h]%?" 
 +</code> 
 + 
 +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. 
 + 
 +If the caption is on a 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> 
 +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<" 
 +</code> 
 + 
 +===== 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. 
 + 
 +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