# $Id: hackysscreenrc,v 0.5 2018/07/29 03:15:53 ??? Exp $
# sources and such
# https://unix.stackexchange.com/questions/74785/how-to-open-tabs-windows-in-gnu-screen-execute-commands-within-each-one
################################################################################
# SCREEN SETTINGS
################################################################################
startup_message off
nethack on
#defflow on # will force screen to process ^S/^Q
deflogin on
autodetach on # preserve my precious screen! ;)
# turn visual bell on
vbell on
vbell_msg "GNOP"
# define a bigger scrollback, default is 100 lines
defscrollback 1500
################################################################################
activity "%{= wk} Window %n"
################################################################################
#backtick id lifespan autorefresh command [args] # was this or so: backtick 0 30 30 sh -c 'screen -ls | grep --color=no -o "$PPID[^[:space:]]*"'
# show number of users on the machine (or your own shells in modern times. ;))
backtick 0 10 10 sh -c 'who | wc -l'
#
# bashiges zeugs PROMPT_COMMAND='printf "\033k\033\134"'
#
# when we open a window, where shall its CWD be?
chdir # without argument it's my $HOME
################################################################################
# SCREEN KEYBINDINGS
################################################################################
# Remove some stupid / dangerous key bindings
#bind L
bind ^\
# Make them better
bind \\ quit
bind I login on
bind O login off
bind } history
bind + resize +1
bind - resize -1
bind = resize =
bind _ resize max
# unbind kill, rebind to upper case K
bind k
bind ^k
bind K kill
# unbind clear
bind C
# unbind XOFF
bind s
bind ^s
# unbind lock
bind x
bind ^x
###bind s screen -t '% |root:' sudo su -l
# Useful zeugs eventuel
##bind ^h screen -t htop sudo su -l -c "htop -d 1"
# An example of a "screen scraper" which will launch urlview on the current
# screen window
#
#bind ^B eval "hardcopy_append off" "hardcopy -h $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview"
#
# ... now a little bit of key bindings
# In case we don't have write permission for /etc/utmp (no s-bit)
# we create even local windows via rlogin. -> Et voila: a utmp-slot
# utmp-slots are strongly recomended to keep sccs and talk happy.
# (thus we have ^A# or. ^Ac for windowcreation with or without utmp-slot.)
# but if we run suid-root, we produce all the rlogins with -ln,
# as nobody shall refer to these pty's.
#bind '!' screen -ln -k faui41 rlogin faui41
#bind '@' screen -ln -k vme2 rlogin faui4_vme2
#bind '#' screen -k faui43
#bind '#' screen -ln -k faui43 rlogin faui43
#bind '$' screen -ln -k faui44 rlogin faui44
#bind '%' screen -ln -k faui45 rlogin faui45
#bind '\^' screen -ln -k sup1 rlogin fausup1
#bind '&' screen -ln -k sup2 rlogin fausup2
#bind '*' screen -ln -k faui48 rlogin faui48
#bind '(' screen -ln -k faui09 rlogin faui09
#bind ')' screen -ln -k faui10 rlogin faui10
#bind 'J' screen -ln -k 4j rlogin faui4j
#bind 'P' screen -ln -k 4p rlogin faui4p
#bind '^C' screen -ln -k 45c rlogin faui45c
#bind '^D' screen -ln -k 45d rlogin faui45d
#bind '^E' screen -ln -k 45e rlogin faui45e
#bind '^I' screen -ln -k 45i rlogin faui45i
#
# these two are logIn and logOut. As a toggle is too stupid.
#bind 'I' set login on
#bind 'O' set login off
bind 'L'
# What happens, when you 'think emacs' and want to erase a whole
# line? You type ^A^K right? Under screen it should be ^Aa^K. But...
# killing the window would be a real punishment for a little mistyping.
bind k #wow! I even amange to type ^Ak by accident.
#bind ^k
#bind K kill
################################################################################
# TERMINAL SETTINGS
################################################################################
# The vt100 description does not mention "dl". *sigh*
termcapinfo vt100 dl=5\E[M
# Set the hardstatus prop on gui terms to set the titlebar/icon title
termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007
################################################################################
# HARDSTATUS AND FOO
################################################################################
# use this for the hard status string
#hardstatus string "%h%? users: %u%?"
# An alternative hardstatus to display a bar at the bottom listing the
# windownames and highlighting the current windowname in blue. (This is only
# enabled if there is no hardstatus setting for your terminal)
#
#hardstatus lastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%< %{+b}%=%Y%M%d-%c"
##hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
#
# old default i think.
#hardstatus alwayslastline "%{Wb}%H%{-}%70>%-Lw%{Yb}%n%f*!!%t%{-}%+Lw%< %=|%{+b}%2D|%Y%m%d-%c"
caption always
caption string "%{Yb}%?%F%{+B Rb}%?%2n %f %t%? %h%?%?%F%{-}%?%=%?%u%?%?%F%{Rb}%?%l"
# out hardstatus will _always_ get displayed in the last line of the terminal screen recognizes..
hardstatus alwayslastline
# old fancy variant, no longer used and changes at 20180729T0240+20:00 (CEST)
#hardstatus string "%{+b dC}%H%{-} %{-b dd}%S%{-} %{+b dy}Usr:%`%{-} %{+b dR}|%{-} %?%{dc}%-Lw%{-}%?%50>%{+b kR}>>%2n%f%{-} %{+b kY}%t%{-} %{+b dR}<<%{-}%?%{kc}%+Lw%{=b dd}%<%?%=%{=b dR}|%{-} %{kC}%Y-%m-%d %c:%s"
# And here we set our hardstatus
hardstatus string "%{+b dC}%H%{-} %{-b dd}%S%{-} %{+b dy}Usr:%`%{-} %{+b dR}|%{-} %?%{dc}%-Lw%{-}%?%50>%{+b kR}>>%2n%f%{-} %{+b kY}%t%{-} %{+b dR}<<%{-}%?%{kc}%+Lw%{=b dd}%<%?%=%{=b dR}|%{-} %{kC}%Y-%m-%d %c:%s"
#hardstatus string 'translation', part by part
#
#%{+b dC} # add specified set of attributes (b=bold, d=default background, C = bright cyan)
#%H% # print %H (hostname if you might wonder)
#{-} # - remove the set from the current attributes (i like to clean up behind myself.. ;)
#%{-b dd} # remove specified attributes (d=default background, d=default foreground) ## yah, i know i'm crazy .. sort of.. ;)
#%S%{-} # print $S (yeah, our session name.. oh, and clean up!)
#%{+b dy}Usr:%`%{-} # add attributes; b=bold, d=default background, y=yellow foreground, print the number of users from a `backticks` command above - and don't forget to clean up! ;)
#%{+b dR}|%{-} # boring stuff, we paint just in bold red on default background a | char. ;)
#%? # NOW, we're talking and getting really fancy.
# # the part to the next %? is displayed only if a % escape inside the part expands to a non-empty string
# %{dc} # default bacckground, cyan foreground
# %-L #
# %{-} # aaand, reset. ;)O
# %?%50> #
# %{+b kR}>> # set bold, black foreground red and print just '>>' ;)
# %2n
# %f # flags of the window
# %{-}
#%{+b kY}%t%{-}
#%{+b dR}<<%{-}%?%{kc}%+Lw%{=b dd}%<%?%=%{=b dR}|%{-}
#%{kC}%Y-%m-%d %c:%s ## The easiest one, kC sets a color and "%Y-%m-%d %c:%s" is just a timestamp (based on ISO8609)
##hardstatus string "%{= KW} %H [%`] %{= Kw}|%{-} %-Lw%{= bW}%n%f %t%{-}%+Lw %{}%=%Y%m%d-%c"
#
# http://www.gnu.org/software/screen/manual/html_node/String-Escapes.html
#
# %= : expand to fill all space (used here to make remaining content flush right)
# %{= wK} : set colors to bright white (W) on bright black (K) and keep current text styles (=)
# %{= wW} : set colors to white (w) on bright black (K) and keep current text styles (=)
# %{-} : restore colors to previous colors / undo last color change
# %{= bW} : set colors to bright white (W) on blue (b) and keep current text styles (=)
# %` : print output of 'backtick' command (defined elsewhere in .screenrc)
# %H : hostname
# %f : window flags
# %t : window title
# %-Lw : list windows before current window (L [optional] = "include flags")
# %+Lw : list windows after current window (L [optional] = "include flags")
# %l : current load of the system
# %n : window number
# %a : session name
# %t : window title
# %u : all other users on this window
# %w : all window numbers and names. With - qualifier: up to the current window; with + qualifier: starting with the window after the current one.
# %W : all window numbers and names except the current one
# %C : current time (12-hr; 24-hr is %c)
# %a : am/pm (lowercase; uppercase is %A)
# %s : seconds
# %Y : current year
# %m : current month (0-padded; %M for "Jan" etc.)
# %d : current date (0-padded)
# [ : opening bracket character
# ] : closing bracket character
# | : bar character
# - : hyphen character
# '%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<'
#The available windows centered at the current win dow and truncated to the available width. The current window is displayed white on blue.
#This can be used with 'hardstatus alwayslastline'
## --> sets %? to true if the window has the focus
#
# '%?%F%{.R.}%?%3n %t%? [%h]%?'
#The window number and title and the window's hardstatus, if one is set. Also use a red background if this is the active focus.
#Useful for 'caption string'.
################################################################################
########## TERMCAP FOO
################################################################################
# all termcap entries are now duplicated as terminfo entries.
# only difference should be the slightly modified syntax, and check for
# terminfo entries, that are already corected in the database.
#
# G0 we have a SEMI-GRAPHICS-CHARACTER-MODE
# WS this sequence resizes our window.
# cs this sequence changes the scrollregion
# hs@ we have no hardware statusline. screen will only believe that
# there is a hardware status line if hs,ts,fs,ds are all set.
# ts to statusline
# fs from statusline
# ds delete statusline
# al add one line
# AL add multiple lines
# dl delete one line
# DL delete multiple lines
# ic insert one char (space)
# IC insert multiple chars
# nx terminal uses xon/xoff
# set these terminals up to be 'optimal' instead of vt100
termcapinfo xterm*|linux*|rxvt*|Eterm* OP
# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E>
# (This fixes the "Aborted because of window size change" konsole symptoms found
# in bug #134198)
termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
# To get screen to add lines to xterm's scrollback buffer, uncomment the
# following termcapinfo line which tells xterm to use the normal screen buffer
# (which has scrollback), not the alternate screen buffer.
#
termcapinfo xterm|xterms|xs|rxvt ti@:te@
# Make the output buffer large for (fast) xterms.
termcapinfo xterm* OL=10000
#termcapinfo xterm* OL=100
# tell screen that xterm can switch to dark background and has function
# keys.
termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l'
termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'
# special xterm hardstatus: use the window title.
termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
#terminfo xterm 'vb=\E[?5h$<200/>\E[?5l'
termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l'
# emulate part of the 'K' charset
termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337'
# Extend the vt100 desciption by some sequences.
termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC
terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
termcapinfo linux C8
# old rxvt versions also need this
# termcapinfo rxvt C8
# Enable non-blocking mode to better cope with flaky ssh connections.
#defnonblock 5
defnonblock on
nonblock on
defutf8 on
utf8 on
# emulate .logout message
pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."
# advertise hardstatus support to $TERMCAP
termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\'
# make the shell in every window a login shell
shell -$SHELL
# don't kill window after the process died
#zombie "^["
# enable support for the "alternate screen" capability in all windows
altscreen on
# DEFAULT KEY BINDINGS
# As mentioned, each screen command consists of a "C-a" followed by one other character. For your convenience, all commands that are bound to lower-case letters are also bound to their control charac\u2010
# ter counterparts (with the exception of "C-a a"; see below), thus, "C-a c" as well as "C-a C-c" can be used to create a window. See section "CUSTOMIZATION" for a description of the command.
#
# The following table shows the default key bindings:
#
# C-a ' (select) Prompt for a window name or number to switch to.
#
# C-a " (windowlist -b)
# Present a list of all windows for selection.
#
# C-a 0 (select 0)
# \u2026 \u2026
# C-a 9 (select 9)
# C-a - (select -) Switch to window number 0 - 9, or to the blank window.
#
# C-a tab (focus) Switch the input focus to the next region. See also split, remove, only.
#
# C-a C-a (other) Toggle to the window displayed previously. Note that this binding defaults to the command character typed twice, unless overridden. For instance, if you use the option
# "-e]x", this command becomes "]]".
#
# C-a a (meta) Send the command character (C-a) to window. See escape command.
#
# C-a A (title) Allow the user to enter a name for the current window.
#
# C-a b
# C-a C-b (break) Send a break to window.
#
# C-a B (pow_break) Reopen the terminal line and send a break.
#
# C-a c
# C-a C-c (screen) Create a new window with a shell and switch to that window.
#
# C-a C (clear) Clear the screen.
#
# C-a d
# C-a C-d (detach) Detach screen from this terminal.
#
# C-a D D (pow_detach) Detach and logout.
#
# C-a f
# C-a C-f (flow) Toggle flow on, off or auto.
#
# C-a F (fit) Resize the window to the current region size.
#
# C-a C-g (vbell) Toggles screen's visual bell mode.
#
# C-a h (hardcopy) Write a hardcopy of the current window to the file "hardcopy.n".
#
# C-a H (log) Begins/ends logging of the current window to the file "screenlog.n".
#
# C-a i
# C-a C-i (info) Show info about this window.
#
# C-a k
# C-a C-k (kill) Destroy current window.
#
# C-a l
# C-a C-l (redisplay) Fully refresh current window.
#
# C-a L (login) Toggle this windows login slot. Available only if screen is configured to update the utmp database.
#
# C-a m
# C-a C-m (lastmsg) Repeat the last message displayed in the message line.
#
# C-a M (monitor) Toggles monitoring of the current window.
#
# C-a space
# C-a n
# C-a C-n (next) Switch to the next window.
#
# C-a N (number) Show the number (and title) of the current window.
#
# C-a backspace
# C-a C-h
# C-a p
# C-a C-p (prev) Switch to the previous window (opposite of C-a n).
#
# C-a q
# C-a C-q (xon) Send a control-q to the current window.
#
# C-a Q (only) Delete all regions but the current one. See also split, remove, focus.
#
# C-a r
# C-a C-r (wrap) Toggle the current window's line-wrap setting (turn the current window's automatic margins on and off).
# C-a s
# C-a C-s (xoff) Send a control-s to the current window.
#
# C-a S (split) Split the current region horizontally into two new ones. See also only, remove, focus.
#
# C-a t
# C-a C-t (time) Show system information.
#
# C-a v (version) Display the version and compilation date.
#
# C-a C-v (digraph) Enter digraph.
#
# C-a w
# C-a C-w (windows) Show a list of window.
#
# C-a W (width) Toggle 80/132 columns.
#
# C-a x
# C-a C-x (lockscreen) Lock this terminal.
#
# C-a X (remove) Kill the current region. See also split, only, focus.
#
# C-a z
# C-a C-z (suspend) Suspend screen. Your system must support BSD-style job-control.
#
# C-a Z (reset) Reset the virtual terminal to its "power-on" values.
#
# C-a . (dumptermcap) Write out a ".termcap" file.
#
# C-a ? (help) Show key bindings.
#
# C-a \ (quit) Kill all windows and terminate screen.
#
# C-a : (colon) Enter command line mode.
#
# C-a [
# C-a C-[
# C-a esc (copy) Enter copy/scrollback mode.
#
# C-a C-]
# C-a ] (paste .) Write the contents of the paste buffer to the stdin queue of the current window.
#
# C-a {
# C-a } (history) Copy and paste a previous (command) line.
#
# C-a > (writebuf) Write paste buffer to a file.
#
# C-a < (readbuf) Reads the screen-exchange file into the paste buffer.
#
# C-a = (removebuf) Removes the file used by C-a < and C-a >.
#
# C-a , (license) Shows where screen comes from, where it went to and why you can use it.
#
# C-a _ (silence) Start/stop monitoring the current window for inactivity.
#
# C-a | (split -v) Split the current region vertically into two new ones.
#
# C-a * (displays) Show a listing of all currently attached displays.
#
#
#
Comments