# screenrc fragment which sets a sophisticated status bar / caption line # Copyright (C) 2002, 2004, 2007, 2018 Fabian Pietsch # # You may use/modify/redistribute this freely, provided that the name and # contact information of the original author as well as this notice are # preserved, and modifications are not misrepresented as the original author's. # # This file had been distributed for some time now at [1]. As of 2018-05-05, # this is supposed to change to distribution via git repository, soon, # with the possible URL of [2]. The previous versions have been imported # into the repository. # # [1] Old: https://www.canvon.de/software/raw/misc/screenrc # [2] Planned: https://github.com/canvon/config-cvn-pub # The statusbar's features include: # o Host name at the left end. (bold if active split region) # o Date and time (MONTH-DAY WEEKDAY HOUR:MINUTE) at the right end. # (bold if active split region) Weekday is padded to 3 chars, # so the time field in cascaded screens with different locale # settings will line up. # o Window numbers, status chars and names in the middle; # if there's not enough space, the list is abbreviated at the left and/or # right end in such a way that the host name, date/time and current window # are always visible. The current window is displayed in bold. # # o Since 2018-05-05, the host name part at the left end # is used for additional signaling: # # * Background turns cyan when the prefix key has been pressed. # * Background turns yellow when in scrollback/copy mode. # # This both is to help avoiding mistakes, especially when using # cascaded screen sessions (local user, root; or local-host, ssh-host, # ssh-host root; etc.) -- It's also nice, then, to see the highlight # moving up through the stack of screen status bars! (on ^A a a ...) # # o Since 2007-10-13, the screen window's hardstatus isn't put in the caption # anymore, as it's frequently very long. Instead: # # The terminal's hardstatus -- in the modern day, this is normally the terminal # emulator's X11 window title -- is used as follows: # # USER@HOST: SESSION WINDOWNUMBER WINDOWTITLE[ \[HARDSTATUS\]] # # Provided the termcapinfo line below is used on other hosts you're using # screen on as well, your xterm / rxvt-unicode / ... window title could read # something like this: # # foo@xhost: ... sshhost [bar@sshhost: ... elinks [http://... - ELinks]] # # This has been changed 2018-05-05 to (1) not entirely rely on the remote host # to communicate a "what's this" information via its hardstatus, but have # that information there via local window title (assuming it has been set # informatively); and (2) clearly encapsulate what hardstatus came from where, # with indication of beginning and end of encapsulated information... # # To set the hardstatus (for a window) manually, (e.g., after exiting an old # version of elinks), run something like the following in that window: # # $ echo -ne '\e]2;MY_HARDSTATUS_CONTENTS\a' # # # Some of my other personal settings are included at the end of the file, # all commented out; read the comments and copy whatever snippets you see fit. # # Please also have a look at the example screenrc distributed with screen; # on a Debian system, this would be: /usr/share/doc/screen/screenrc # set colors to light gray on light blue #sorendition 10 74 rendition so "= " bw # set a sophisticated status bar / caption line; see above for explanations #caption always '%?%F%{!b}%?%H%?%F%{-}%?|%0L=%-Lw%{!b}%50L>%n*%f %t%{-}%+Lw%-12=|%?%F%{!b}%?%m-%d %0c%?%F%{-}%?' #caption always '%?%P%{.y.}%?%?%E%{.c.}%?%?%F%{+b}%?%H%?%F%{-}%?%?%E%{-}%?%?%P%{-}%?|%0L=%-Lw%{+b}%50L>%n*%f %t%{-}%+Lw%-15=|%?%F%{+b}%?%m-%d %D %0c%?%F%{-}%?' # ^ Experiment 2016-11-04/-05 caption always '%?%P%{.y.}%?%?%E%{.c.}%?%?%F%{+b}%?%H%?%F%{-}%?%?%E%{-}%?%?%P%{-}%?|%0L=%-Lw%{+b}%50L>%n*%f %t%{-}%+Lw%-16=|%?%F%{+b}%?%m-%d %D %-5=%0c' # ^ Fix compatible with german (two-letter weekday abbrev.) *and* non-german (three-letter) locale # The following is based on Debian's default /etc/screenrc # turn sending of screen messages to hardstatus off hardstatus off # Set the hardstatus prop on gui terms to set the titlebar/icon title # Note: Unlike the Debian default, this includes screen*; so a screen-in-screen, # possibly on a different host, will set a hardstatus for the enclosing screen. termcapinfo xterm*|rxvt*|kterm*|Eterm*|screen* hs:ts=\E]0;:fs=\007:ds=\E]0;\007 # use this for the hard status string #hardstatus string "%h%? users: %u%?" #hardstatus string "$USER@%H%? - %h%?" hardstatus string "$USER@%H: %S %n %t%? [%h]%?" # ^ Experiment 2016-11-04/-05 # End of being based on Debian's default /etc/screenrc # Since I don't want to essentially duplicate the example screenrc, only a few # pointers; these things might be useful in addition to the above: #startup_message off #escape ^Yy # ^Aa, the default, is cumbersome when frequently using # readline/EMACS keybindings to navigate around in bash... ;) # But I'd only recommend it if you've got a right Ctrl key, too. #zombie cr # [key rebindings, especially to remove dangerous defaults; # omitted here, see example screenrc] #vbell on #defscrollback 1024 # Get a bit more qwerty-targetted comfort on qwertz, as well. (Unless UTF-8...) #bind 'ä' select #bind 'Ä' windowlist -b #bind '#' windowlist -b #bind 'ü' copy #bind '+' paste . # The default screenrc has an interesting hack to paste correctly in spite of # autoindent mode; modified for ":set [no]paste" in modern VIM: #register [ "\033:se paste\015a" #register ] "\033:se nopaste\015a" #bind ^] paste [.] # Then paste with Ctrl-y Ctrl-AltGr-9 (if you're using "escape ^Yy") # Create new windows with number 4+, except with Ctrl: 1+ Keeps 0 for root. #bind c screen 4 #bind ^C screen 1 # Create a default window and run some initial commands in the shell in it. #screen -t misc 4 #stuff "df -ml^Jgcal-dates^J" # Use Ctrl-y Shift-[1-9] to start frequently used programs: #bind '!' screen -t root -ln 0 su - #bind '"' screen 2 mutt -y #bind '$' screen -t log -ln 2 less +F /var/log/syslog /var/log/auth.log #bind '%' screen -t apache -ln 2 bash -c "cd /var/log/apache2 && exec less +F *.log" #bind '/' screen 1 ssh-to # ... etc. # # You may wish to use "large" window numbers and special bindings to select them # for some frequently used, long-term windows, to avoid them "stealing" from # the precious 1-9 range of window numbers. #bind '(' screen -t bt 20 rtorrent #bind 'L' screen -t dl 20 #bind O select 20 # # Apparently, 39 is the highest window number supported by screen 4.00.03. :'( #bind ')' screen 39 cmus #bind o select 39 # Use UTF-8 screen with all windows defaulting to latin1 -- this way, all # programs and data can safely stay in the "legacy encoding", but you can # create UTF-8 or even EUC-JP windows and have their content possibly # auto-converted and possibly displayed as UTF-8 on your UTF-8 terminal you are # running screen on. # # In other words, be conservative by default, but allow cool stuff to happen # when needed; e.g., display of Kana & Kanji. #defutf8 off #setenv LANG de_DE # # # Note: The following examples assume you're using "escape ^Yy". # # Start irssi in an UTF-8 window. #register i "^Y:screen -t irssi 1 env LANG=de_DE.UTF-8 irssi^J^Y:utf8 on^J" #bind '&' process i # # Ssh to myhost using UTF-8 as encoding. #register m "^Y:screen -t myhost 1 env LANG=de_DE.UTF-8 ssh myhost^J^Y:utf8 on^J" #bind '&' process m # # # Create windows in various encodings/locales (provided the locale is installed) # # UTF-8 #register u "^Y:screen -t utf8 2 env LANG=de_DE.UTF-8 $SHELL^J^Y:utf8 on^J" #bind 'u' process u # # ISO-8859-1 a.k.a. latin1 #register l "^Y:screen -t latin1 2 env LANG=de_DE $SHELL^J^Y:utf8 off^J" #bind 'U' process l # # EUC-JP (Pre-Unicode Japanese multibyte encoding) #register e "^Y:screen -t eucJP 2 env LANG=ja_JP $SHELL^J^Y:encoding eucJP^J" #bind 'e' process e