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:47]
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 ======
 +
 +===== Basics =====
 +
 +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).
 +
 +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.
 +
 +===== Extras =====
 +
 +==== Hardstatus Lines ====
 +
 +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.
 +
 +''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]]'').
 +
 +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'''s
 +[[man:string escapes]].  The default value is ''%h'', which just displays
 +the current window's hstatus string.
 +
 +==== Status Bar ====
 +
 +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'''s
 +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's
 +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's
 +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 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's license information.
 +
 +===== Commands =====
 +
 +  * ''[[commands:attrcolor]]'' - Remaps the effect of text attributes.
 +  * ''[[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: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