ScreenShot: https://github.com/oldgaro/dots/blob/master/README.md
# GNU SCREEN
# https://www.gnu.org/software/screen/manual/screen.html
# 256 colors - Editors
term screen-256color
# 24bits - True color
truecolor on
# -------------------- BINDS
# Start at window 1
bind c screen 1
bind ^c screen 1
bind 0 select 10
bind j focus down
bind k focus up
bind t focus top
bind b focus bottom
# define layouts
layout new 'horizontal'
split
layout new 'vertical'
split -v
layout new 'main'
# Resize
bind = resize =
bind + resize +3
bind - resize -3
# bind control sequences for new layouts
bind V layout select 'vertical'
bind H layout select 'horizontal'
bind ' ' layout next # <- actually means Ctrl-a + Space
# This one is great, restarts/reloads screen
bind . eval 'source /etc/screenrc' 'echo "/etc/screenrc has been reloaded."'
# --------------------------
# Statusline String
hardstatus alwayslastline "%{= kb}[ %1` ]%= %{= kw}%?%-w%?%{r}(%{g} %n %t%?(%u)%?%{r} )%{w}%?%+w%?%?%= [%{Y} %d/%m %{Y}%c %{W}]"
# backticks - The output of such a command is used for substitution
# session title
backtick 1 30 30 sh -c 'screen -ls | grep -i attached | cut -f 2 -d '.' | cut -f1'
# Open named windows at start
screen -t "$" 1
chdir $HOME
screen -t "Music" 2 cmus
screen -t "Ranger" 3 ranger
# Open in Window [number] at start
select 1
# Get rid of the vertical bars
rendition so =00
# This sets the back- and foreground color to default (d) and displays nothing (" ").
caption string "%{03} "
#Turn welcome message off
startup_message off
# Fix for residual editor text
altscreen on
# message display duration
msgwait 3
# Increase the scrollback buffer
defscrollback 5000
# disable vbell (so wm urgency hints can work from within screen)
vbell on
# hardcopydir: The directory which contains all hardcopies.
hardcopydir ~/.config/screen
bufferfile ~/.config/screen/buffer
then4116 wrote:Zombie threat I know, but I'm a bit proud of this unholy mess:
Where... where. Shall we bring out the shotguns?
But really, that's a very complex .screenrc! And you are brave enough to use nested sessions too.
heh, funny typo XD
Edit:
made the color changing stuff a lot more manageable through the use of registers!
Edit:
added new bindings for moving windows left/right
nesting depth is now displayed at the beginning of the caption line (in parentheses)
changed shortbatt so that it only shows up if there's something to display (same as shortextip)
Edit:
added new bindings to hide/show both status & caption line
made changing the keybindings for nesting depth less redundant and more managable via registers
Edit:
new feature: more easily move windows left/right with SHIFT + the F-key you'd use to switch window left/right on the corresponding nesting layer
Edit:
added a whooping 9 color schemes for caption & hardstatus line, in addition to the preexisting 7, for a total of 16. Taste the rainbow!
Also re-added left-handed mode for switching between windows, though not with easy keybindings to switch between leftie & righty mode. You have to comment/uncomment sections of the screenrc.
Also added 3 fun clock displays: Unix timestamp in hex, binary & Gray code!
Edit:
Major update! Added support (read: nice keybindings) for layouts
including a new 'layout mode' that makes changing layouts almost as nice as in tmux!
added color changing for the message/command/region border/copy text.
Also decided to scrap registers for the status lines for good. Was getting more troublesome with each successive update.
Edit:
semi-major redesign of the hardstatus line: Now the separator | characters are dynamically shown or hidden based on whether or not the backtick after them is on or off. Makes the whole thing a lot prettier if you choose not to display all the status monitors.
Also added a new one-liner to keep track of available storage space on your file systems! Please remember to change the list of devices/filesystems to fit your computer!
Also added another 'mode' for dealing with multi-region layouts: !!-mode lets you use Alt+arrow keys to switch between regions, regardless of nesting depth. Works in X11; still working on tty.
Edit:
No more external scripts! All the backticks are now realized purely within screenrc!
And a lot of commenting & code beautification
Edit:
added a new backtick to display CPU usage percentage for each core (updated every second), as an alternative to traditional load averages
added a new clock display: Discordian date! (depends on ddate)
new scrolling mode for the IP address display
the bindings for moving windows left/right now get set/unset dynamically (depending on nesting depth), too!
Edit:
re-implemented all multi-key bindings that start with ^A with bind & command classes instead of bindkey -t. This has the effect that the %E string escape works now, so you get a visual indication when a screen session has received the command character (session name is inverted). Very helpful in nested sessions. Inspired by freenode user ski
Edit:
added a neat little curses SSH & screen session manager (depends on dialog), because this screenrc is aimed at people who work on a lot of hosts & with a lot of sessions.
more caption & hardstatus madness: session name & clock can be moved dynamically from the caption to the hardstatus, and the window list in the caption can be reduced to show only the current window. Both options are useful when dealing with complex layouts.
###### screenrc
###### by then4116
###### This config is aimed at powerusers, who work on a lot of machines, and need a lot of information at a glance
###### It's intended to facilitate usage of deeply nested screen sessions, and complex layouts
###### as such, it relies heavily on keybindings to modify other keybindings, and multi-key bindings
###### default keybindings have been left mostly intact, but not completely
###### IT'S RECOMMENDED TO READ THE CONFIG BEFORE USING IT
##########################################################################################
###### PLEASE DON'T FORGET change your .bashrc as specified at the end of the file! ######
##########################################################################################
### some options
#defscrollback 99999 # set scrollback buffer to 'a shitload'. CAUTION! causes high memory consumption!
defscrollback 1000 # set scrollback buffer to 1000, which seems to me to be a more sensible default than 100
defutf8 on # set utf8
defencoding UTF-8
vbell off # disable visual bell
startup_message off # disable startup message 'new screen ..'
#setenv DISPLAY ':0' # eg for mplayer
deflog off # enable/disable logging here
logfile /root/screen.%n # set log location
nethack off # nethack like notifications
defmonitor off # turn off monitoring (for activity)
activity "activity in %n%f %t" # enable activity
multiuser on # enable screen -x
shell bash # default shell
autodetach on # automatically detach upon hangup
defnonblock 1
mousetrack on # turn on if you want to switch regions via mouse click. Will interfere with text selection via mouse in xterm though, so off by defult.
altscreen on
msgwait 3 # message display duration
maptimeout 500
defzombie " !"
termcapinfo xterm|xterms|xs|rxvt ti@:te@ # use xterm's normal screen buffer (which includes scrollback). Makes scrolling back with mouse/touchpad in X11 useful.
termcapinfo * Z0=\E[?3h:Z1=\E[?3l
term screen-256color
attrcolor b ".I"
hardstatus off
shelltitle '>|bash' # necessary for window autorenaming magic. Set the first character in the quotes to whatever your bash prompt ends in.
windowlist title "windowlist"
windowlist string "%n%f %t%{kk}%="
### some keybindings
bind ^W sessionname
bind 'w' windows
bind '\' quit #'
bind 'K' kill
bind 'S' eval 'split' 'focus' 'windowlist -b -g'
bind '|' eval 'split -v' 'focus' 'windowlist -b -g'
bind '"' windowlist -b -g
bind 'g' eval 'screen //group' 'register : "^AA^H^H^H^H^H"' 'process :'
bind 'G' eval 'register : "^A:group "' 'process :'
bind ^M mapnotnext
#bind 'F' flow
### window navigation
# basically, if you don't want to use nested sessions, you can just enjoy being able to switch windows with F11/F12 (and move them wit Shift+F11/F12), instead of the tedious ^Ap and ^An (and the slightly less tedious ^A^A and ^A[0-9])
# However, if you've discovered the usefulness of nested sessions, this is for you:
# With these key bindings, you can make a nested screen session 'aware' of how deeply it's nested. This changes the bindings for switching windows to other F-keys, so that, even in deeply nested sessions, it still only takes a single keystroke to switch windows.
# beware: changing around the nesting depth too much tends to break screen's ability to interpret the F-keys at all. In these cases, it helps to detach (^Ad) & reattach (screen -r) or to lock (^Ax) & unlock the screen session.
# these bindings set the nesting depth, i.e. switch the keys for window navigation between F11/F12, F9/F10, F7/F8, F5/F6, F3/F4 & F1/F2 - useful for managing nested sessions
# usage: press ^AU[0123456] (or ^AUl[0123456] for left handed mode). The digit is the nesting depth. Nesting depth 0 means that no bindings are set, which is useful for 'transparent' sessions.
# this is also called whenever the nesting depth of a session is changed (see below how to do that). Frees up the bindings on the F-keys, before the new ones are set for the new nesting depth.
bind U command -c U
bind -c U - command -c U-
bind -c U- 6 eval 'bindkey -k k1' 'bindkey -k k2' 'bindkey "^[^[OP"' 'bindkey "^[^[OQ"'
bind -c U- 5 eval 'bindkey -k k3' 'bindkey -k k4' 'bindkey "^[^[OR"' 'bindkey "^[^[OS"'
bind -c U- 4 eval 'bindkey -k k5' 'bindkey -k k6' 'bindkey "^[^[[15~"' 'bindkey "^[^[[17~"'
bind -c U- 3 eval 'bindkey -k k7' 'bindkey -k k8' 'bindkey "^[^[[18~"' 'bindkey "^[^[[19~"'
bind -c U- 2 eval 'bindkey -k k9' 'bindkey -k k;' 'bindkey "^[^[[20~"' 'bindkey "^[^[[21~"'
bind -c U- 1 eval 'bindkey -k F1' 'bindkey -k F2' 'bindkey "^[^[[23~"' 'bindkey "^[^[[24~"'
bind -c U 0 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(0) "'
bind -c U 1 eval 'register : "^AU-2^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23' 'bindkey -k F1 eval "register : \"^Ap\"" "process :"' 'bindkey -k F2 eval "register : \"^An\"" "process :"' 'bindkey "^[^[[23~" eval "register : \"^A;p\"" "process :"' 'bindkey "^[^[[24~" eval "register : \"^A;n\"" "process :"'
bind -c U 2 eval 'register : "^AU-1^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(2) "' 'bindkey -k k9 eval "register : \"^Ap\"" "process :"' 'bindkey -k k; eval "register : \"^An\"" "process :"' 'bindkey "^[^[[20~" eval "register : \"^A;p\"" "process :"' 'bindkey "^[^[[21~" eval "register : \"^A;n\"" "process :"'
bind -c U 3 eval 'register : "^AU-1^AU-2^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(3) "' 'bindkey -k k7 eval "register : \"^Ap\"" "process :"' 'bindkey -k k8 eval "register : \"^An\"" "process :"' 'bindkey "^[^[[18~" eval "register : \"^A;p\"" "process :"' 'bindkey "^[^[[19~" eval "register : \"^A;n\"" "process :"'
bind -c U 4 eval 'register : "^AU-1^AU-2^AU-3^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(4) "' 'bindkey -k k5 eval "register : \"^Ap\"" "process :"' 'bindkey -k k6 eval "register : \"^An\"" "process :"' 'bindkey "^[^[[15~" eval "register : \"^A;p\"" "process :"' 'bindkey "^[^[[17~" eval "register : \"^A;n\"" "process :"'
bind -c U 5 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(5) "' 'bindkey -k k3 eval "register : \"^Ap\"" "process :"' 'bindkey -k k4 eval "register : \"^An\"" "process :"' 'bindkey "^[^[OR" eval "register : \"^A;p\"" "process :"' 'bindkey "^[^[OS" eval "register : \"^A;n\"" "process :"'
bind -c U 6 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-5"' 'process :' 'backtick 23 3600 3600 printf "(6) "' 'bindkey -k k1 eval "register : \"^Ap\"" "process :"' 'bindkey -k k2 eval "register : \"^An\"" "process :"' 'bindkey "^[^[OP" eval "register : \"^A;p\"" "process :"' 'bindkey "^[^[OQ" eval "register : \"^A;n\"" "process :"'
#bind -c U- 6 eval 'bindkey -k k1' 'bindkey -k k2' 'bindkey "^[O2P"' 'bindkey "^[O2Q"'
#bind -c U- 5 eval 'bindkey -k k3' 'bindkey -k k4' 'bindkey "^[O2R"' 'bindkey "^[O2S"'
#bind -c U- 4 eval 'bindkey -k k5' 'bindkey -k k6' 'bindkey "^[[15;2~"' 'bindkey "^[[17;2~"'
#bind -c U- 3 eval 'bindkey -k k7' 'bindkey -k k8' 'bindkey "^[[18;2~"' 'bindkey "^[[19;2~"'
#bind -c U- 2 eval 'bindkey -k k9' 'bindkey -k k;' 'bindkey "^[[20;2~"' 'bindkey "^[[21;2~"'
#bind -c U- 1 eval 'bindkey -k F1' 'bindkey -k F2' 'bindkey "^[[23;2~"' 'bindkey "^[[24;2~"'
#
#bind -c U 0 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(0) "'
#bind -c U 1 eval 'register : "^AU-2^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23' 'bindkey -k F1 eval "register : \"^Ap\"" "process :"' 'bindkey -k F2 eval "register : \"^An\"" "process :"' 'bindkey "^[[23;2~" eval "register : \"^A;p\"" "process :"' 'bindkey "^[[24;2~" eval "register : \"^A;n\"" "process :"'
#bind -c U 2 eval 'register : "^AU-1^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(2) "' 'bindkey -k k9 eval "register : \"^Ap\"" "process :"' 'bindkey -k k; eval "register : \"^An\"" "process :"' 'bindkey "^[[20;2~" eval "register : \"^A;p\"" "process :"' 'bindkey "^[[21;2~" eval "register : \"^A;n\"" "process :"'
#bind -c U 3 eval 'register : "^AU-1^AU-2^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(3) "' 'bindkey -k k7 eval "register : \"^Ap\"" "process :"' 'bindkey -k k8 eval "register : \"^An\"" "process :"' 'bindkey "^[[18;2~" eval "register : \"^A;p\"" "process :"' 'bindkey "^[[19;2~" eval "register : \"^A;n\"" "process :"'
#bind -c U 4 eval 'register : "^AU-1^AU-2^AU-3^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(4) "' 'bindkey -k k5 eval "register : \"^Ap\"" "process :"' 'bindkey -k k6 eval "register : \"^An\"" "process :"' 'bindkey "^[[15;2~" eval "register : \"^A;p\"" "process :"' 'bindkey "^[[17;2~" eval "register : \"^A;n\"" "process :"'
#bind -c U 5 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(5) "' 'bindkey -k k3 eval "register : \"^Ap\"" "process :"' 'bindkey -k k4 eval "register : \"^An\"" "process :"' 'bindkey "^[O2R" eval "register : \"^A;p\"" "process :"' 'bindkey "^[O2S" eval "register : \"^A;n\"" "process :"'
#bind -c U 6 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-5"' 'process :' 'backtick 23 3600 3600 printf "(6) "' 'bindkey -k k1 eval "register : \"^Ap\"" "process :"' 'bindkey -k k2 eval "register : \"^An\"" "process :"' 'bindkey "^[O2P" eval "register : \"^A;p\"" "process :"' 'bindkey "^[O2Q" eval "register : \"^A;n\"" "process :"'
#bind -c U- 6 eval 'bindkey -k k1' 'bindkey -k k2' 'bindkey "\033\117\062\120"' 'bindkey "\033\117\062\121"'
#bind -c U- 5 eval 'bindkey -k k3' 'bindkey -k k4' 'bindkey "\033\117\062\122"' 'bindkey "\033\117\062\123"'
#bind -c U- 4 eval 'bindkey -k k5' 'bindkey -k k6' 'bindkey "\033\133\061\065\073\062\176"' 'bindkey "\033\133\061\067\073\062\176"'
#bind -c U- 3 eval 'bindkey -k k7' 'bindkey -k k8' 'bindkey "\033\133\061\070\073\062\176"' 'bindkey "\033\133\061\071\073\062\176"'
#bind -c U- 2 eval 'bindkey -k k9' 'bindkey -k k;' 'bindkey "\033\133\062\060\073\062\176"' 'bindkey "\033\133\062\061\073\062\176"'
#bind -c U- 1 eval 'bindkey -k F1' 'bindkey -k F2' 'bindkey "\033\133\062\063\073\062\176"' 'bindkey "\033\133\062\064\073\062\176"'
#
#bind -c U 0 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(0) "'
#bind -c U 1 eval 'register : "^AU-2^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23' 'bindkey -k F1 eval "register : \"^Ap\"" "process :"' 'bindkey -k F2 eval "register : \"^An\"" "process :"' 'bindkey "\033\133\062\063\073\062\176" eval "register : \"^A;p\"" "process :"' 'bindkey "\033\133\062\064\073\062\176" eval "register : \"^A;n\"" "process :"'
#bind -c U 2 eval 'register : "^AU-1^AU-3^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(2) "' 'bindkey -k k9 eval "register : \"^Ap\"" "process :"' 'bindkey -k k; eval "register : \"^An\"" "process :"' 'bindkey "\033\133\062\060\073\062\176" eval "register : \"^A;p\"" "process :"' 'bindkey "\033\133\062\061\073\062\176" eval "register : \"^A;n\"" "process :"'
#bind -c U 3 eval 'register : "^AU-1^AU-2^AU-4^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(3) "' 'bindkey -k k7 eval "register : \"^Ap\"" "process :"' 'bindkey -k k8 eval "register : \"^An\"" "process :"' 'bindkey "\033\133\061\070\073\062\176" eval "register : \"^A;p\"" "process :"' 'bindkey "\033\133\061\071\073\062\176" eval "register : \"^A;n\"" "process :"'
#bind -c U 4 eval 'register : "^AU-1^AU-2^AU-3^AU-5^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(4) "' 'bindkey -k k5 eval "register : \"^Ap\"" "process :"' 'bindkey -k k6 eval "register : \"^An\"" "process :"' 'bindkey "\033\133\061\065\073\062\176" eval "register : \"^A;p\"" "process :"' 'bindkey "\033\133\061\067\073\062\176" eval "register : \"^A;n\"" "process :"'
#bind -c U 5 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-6"' 'process :' 'backtick 23 3600 3600 printf "(5) "' 'bindkey -k k3 eval "register : \"^Ap\"" "process :"' 'bindkey -k k4 eval "register : \"^An\"" "process :"' 'bindkey "\033\117\062\122" eval "register : \"^A;p\"" "process :"' 'bindkey "\033\117\062\123" eval "register : \"^A;n\"" "process :"'
#bind -c U 6 eval 'register : "^AU-1^AU-2^AU-3^AU-4^AU-5"' 'process :' 'backtick 23 3600 3600 printf "(6) "' 'bindkey -k k1 eval "register : \"^Ap\"" "process :"' 'bindkey -k k2 eval "register : \"^An\"" "process :"' 'bindkey "\033\117\062\120" eval "register : \"^A;p\"" "process :"' 'bindkey "\033\117\062\121" eval "register : \"^A;n\"" "process :"'
bind B eval 'escape ^Bb' 'bind A eval "escape ^Aa" "bind A title" "echo \"transparent mode off\"" ' 'echo "transparent mode. [\^BA] to exit"'
# move windows
bind , eval 'number -1' 'command -c dotcom'
bind . eval 'number +1' 'command -c dotcom'
bind -c dotcom , eval 'number -1' 'command -c dotcom'
bind -c dotcom . eval 'number +1' 'command -c dotcom'
# send the command character and set the nesting depth more easily, because typing out "^Aaaaaa" is tedious and error prone.
# usage: press ^Ay[123456] in the outermost session to send the command character to the desired nesting depth.
# press ^Au[123456] (or ^Aul[0123456] for left handed mode) in the outermost session to make the session on the specified nesting depth aware of its nesting depth
bind u command -c u
bind -c u 0 eval 'register : "^AU0"' 'process :'
bind -c u 1 eval 'register : "^AU1"' 'process :'
bind -c u 2 eval 'register : "^AaU2"' 'process :'
bind -c u 3 eval 'register : "^AaaU3"' 'process :'
bind -c u 4 eval 'register : "^AaaaU4"' 'process :'
bind -c u 5 eval 'register : "^AaaaaU5"' 'process :'
bind -c u 6 eval 'register : "^AaaaaaU6"' 'process :'
bind y command -c y
bind -c y 1 command
bind -c y 2 stuff "^A"
bind -c y 3 stuff "^Aa"
bind -c y 4 stuff "^Aaa"
bind -c y 5 stuff "^Aaaa"
bind -c y 6 stuff "^Aaaaa"
# initialization
eval 'register : "^AU1"' 'process :'
# since the F-keys are now potentially used up, you can send them to the shell via keybindings.
# incidentally, this is also useful if you're forced to use a crippled keyboard that doesn't have F-keys
# Usage: press ^A, and then type out f5, f12 or whatever. F1 must be sent as ^Af01
bind f command -c f
bind -c f 0 command -c f0
bind -c f 1 command -c f1
bind -c f0 1 stuff "^[OP~"
bind -c f 2 stuff "^[OQ~"
bind -c f0 2 stuff "^[OQ~"
bind -c f 3 stuff "^[OR~"
bind -c f0 3 stuff "^[OR~"
bind -c f 4 stuff "^[OS~"
bind -c f0 4 stuff "^[OS~"
bind -c f 5 stuff "^[[15~"
bind -c f0 5 stuff "^[[15~"
bind -c f 6 stuff "^[[17~"
bind -c f0 6 stuff "^[[17~"
bind -c f 7 stuff "^[[18~"
bind -c f0 7 stuff "^[[18~"
bind -c f 8 stuff "^[[19~"
bind -c f0 8 stuff "^[[19~"
bind -c f 9 stuff "^[[20~"
bind -c f0 9 stuff "^[[20~"
bind -c f1 0 stuff "^[[21~"
bind -c f1 1 stuff "^[[23~"
bind -c f1 2 stuff "^[[24~"
### some niceties for dealing with layouts & regions
layout new # initialize with one layout instead of none
bind o layout show # show all layouts; active layout is marked with *
bind C eval 'register : "^A:layout new "' 'process :' 'bindkey \015 eval "bindkey \\015" "register : ^M" "process :" "layout show"' # create a layout
bind V eval 'layout remove' 'layout show' # remove current layout
bind P eval 'layout prev' 'layout show' # previous layout
bind N eval 'layout next' 'layout show' # next layout
bind O eval 'register : "^A:layout title "' 'process :' 'bindkey \015 eval "bindkey \\015" "register : ^M" "process :" "layout show"' # change layout title
bind h focus left
bind j focus down
bind k focus up
bind l focus right
# this next (monstrous) command implements a 'layout mode' that allows you to rearrange your layouts in a more accessible fashion than vanilla screen, and maybe almost as nice as tmux.
# keybindings in 'layout mode':
# tab: focus next region
# shift+tab: focus previous region
# arrow keys: focus neighboring region (unless the arrow keys are captured by something else)
# h: focus left
# j: focus down
# k: focus up
# l: focus right
# H: decrease region width
# J: increase region height
# K: decrease region height
# L: increase region width
# Y/Z: decrease region width by 10
# U: increase region height by 10
# I: decrease region height by 10
# O: increase region width by 10
# =: equalize region sizes
# s: horizontal split
# |: vertical split
# x: remove current region
# q: remove all regions but the current one
# f: fit window size to current region
# C: create new layout
# V: remove current layout
# c: create new window
# v: kill current window
# p: select previous layout
# n: select next layout
# o: show layouts
# i: show window info (including dimensions)
# r: exit layout mode
# note that, ironically, you can't change layout titles in layout mode. That's because the keybindings interfere with typing the command 'layout title', and would probably interfere with typing the new title as well.
bind R eval 'backtick 20 3600 3600 printf " Layout mode. [r] to exit "' 'bindkey \011 focus' 'bindkey ^[[Z focus prev' 'bindkey h focus left' 'bindkey j focus down' 'bindkey k focus up' 'bindkey l focus right' 'bindkey -k ku focus up' 'bindkey -k kd focus down' 'bindkey -k kr focus right' 'bindkey -k kl focus left' 'bindkey H resize -h -1' 'bindkey J resize -v +1' 'bindkey K resize -v -1' 'bindkey L resize -h +1' 'bindkey Y resize -h -10' 'bindkey Z resize -h -10' 'bindkey U resize -v +10' 'bindkey I resize -v -10' 'bindkey O resize -h +10' 'bindkey = eval "resize =" "resize -h =" "info"' 'bindkey f eval "fit" "info"' 'bindkey C eval "layout new" "layout show"' 'bindkey c screen' 'bindkey V eval "layout remove" "layout show"' 'bindkey v kill' 'bindkey o layout show' 'bindkey i info' 'bindkey p eval "layout prev" "layout show"' 'bindkey n eval "layout next" "layout show"' 'bindkey s eval "split" "focus" "windowlist -b -g"' 'bindkey | eval "split -v" "focus" "windowlist -b -g"' 'bindkey \" windowlist -b -g' 'bindkey q only' 'bindkey x remove' 'bindkey r eval "bindkey \"\\011\"" "bindkey ^[[Z" "bindkey h" "bindkey j" "bindkey k" "bindkey l" "bindkey -k ku" "bindkey -k kd" "bindkey -k kr" "bindkey -k kl" "bindkey H" "bindkey J" "bindkey K" "bindkey L" "bindkey Y" "bindkey Z" "bindkey U" "bindkey I" "bindkey O" "bindkey =" "bindkey f" "bindkey C" "bindkey c" "bindkey V" "bindkey v" "bindkey o" "bindkey i" "bindkey p" "bindkey n" "bindkey r" "bindkey s" "bindkey |" "bindkey \"\\042\"" "bindkey q" "bindkey x" "backtick 20"'
bind '/' command -c slash
bind -c slash 0 eval 'layout select 0' 'layout show'
bind -c slash 1 eval 'layout select 1' 'layout show'
bind -c slash 2 eval 'layout select 2' 'layout show'
bind -c slash 3 eval 'layout select 3' 'layout show'
bind -c slash 4 eval 'layout select 4' 'layout show'
bind -c slash 5 eval 'layout select 5' 'layout show'
bind -c slash 6 eval 'layout select 6' 'layout show'
bind -c slash 7 eval 'layout select 7' 'layout show'
bind -c slash 8 eval 'layout select 8' 'layout show'
bind -c slash 9 eval 'layout select 9' 'layout show'
### caption & hardstatus
# fancy new backtick plan:
#1..9: info items
#20..29: other visible stuff (borders, modes)
backtick 20 # used to display 'layout mode' in the hardstatus line.
backtick 21 3600 3600 printf "|" # left & right border in caption & hardstatus line.
backtick 22 # also left & right border in caption & hardstatus, but with blinking in the active window. Used for !!-mode, off by default.
backtick 23 # empty by default. Is changed to display the nesting depth as you set it.
backtick 24 3600 3600 printf "$USER"
backtick 25 # current preset. empty by default.
# crazy shit alert: This ugly mess is the least insane (though still plenty insane) way I could think of to make a single keybinding toggle something on and off. With this, you can put a screen session into a mode where (1) you can switch between different regions with Alt+arrow keys, and (2) the active region is helpfully marked with blinking !s on either side of the caption line
# usage: ^A!!
bind ! command -c exclam
bind -c exclam : command -c exclamcolon
bind -c exclamcolon 1 eval 'backtick 21' 'backtick 22 3600 3600 printf "!"' 'bindkey "^[k" focus up' 'bindkey "^[j" focus down' 'bindkey "^[l" focus right' 'bindkey "^[h" focus left' 'bind -c exclam ! eval "register : ^A!:0" "process :"'
bind -c exclamcolon 0 eval 'backtick 22' 'backtick 21 3600 3600 printf "|"' 'bindkey "^[k"' 'bindkey "^[j"' 'bindkey "^[l"' 'bindkey "^[h"' 'bind -c exclam ! eval "register : ^A!:1" "process :"'
bind -c exclam ! eval 'register : ^A!:1' 'process :'
#40..59: toggles on caption line (for info items that can be on the caption or the hardstatus line). Empty backtick means that the corresponding info item is displayed.
# backtick 41 # session name
# backtick 42 # other windows
# backtick 43 # current window
# backtick 44 # clock
#60..79: toggles on hardstatus line
# backtick 61 # session name
# backtick 62 # other windows
# backtick 63 # current window
# backtick 64 # clock
# enter statusbar config mode: ^A#, then navigate by the info shown. '#' goes back, repeating the key which took you to a submenu re-displays the submenu.
bind '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash0 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash1 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash2 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash3 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash4 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash5 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash6 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash7 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash8 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
bind -c hash9 '#' eval 'command -c hash' 'echo "statusbar cfg: [0]: bar config, [123456789]: info items, [roygcbmwROYGCBMW]: colors"'
# screen session title
bind -c hash 1 eval 'command -c hash1' 'echo "session title: [0]: off, [2]: full title, [3]: short, [k]: on caption, [j]: on hardstatus"'
bind -c hash1 1 eval 'command -c hash1' 'echo "session title: [0]: off, [2]: full title, [3]: short, [k]: on caption, [j]: on hardstatus"'
bind -c hash1 0 backtick 1
bind -c hash1 2 eval "backtick 1 60 60 sh -c 'echo $(screen -ls | grep -o \"\$PPID[\^[:space:]]*\"):'"
bind -c hash1 3 backtick 1 60 60 sh -c 'printf "$PPID:"'
bind -c hash1 k eval 'backtick 41' 'backtick 61 3600 3600 printf " "'
bind -c hash1 j eval 'backtick 41 3600 3600 printf " "' 'backtick 61'
# window list
bind -c hash 2 eval 'command -c hash2' 'echo "windows: [3]: in caption line, [4]: on hardstatus line, [5]: as info popup"'
bind -c hash2 2 eval 'command -c hash2' 'echo "windows: [3]: in caption line, [4]: on hardstatus line, [5]: as info popup"'
bind -c hash23 '#' eval 'command -c hash2' 'echo "windows: [3]: in caption line, [4]: on hardstatus line, [5]: as info popup"'
bind -c hash24 '#' eval 'command -c hash2' 'echo "windows: [3]: in caption line, [4]: on hardstatus line, [5]: as info popup"'
bind -c hash25 '#' eval 'command -c hash2' 'echo "windows: [3]: in caption line, [4]: on hardstatus line, [5]: as info popup"'
bind -c hash2 3 eval 'command -c hash23' 'echo "windows on caption line: [2]: off, [4]: full, [5]: only active"'
bind -c hash23 3 eval 'command -c hash23' 'echo "windows on caption line: [2]: off, [4]: full, [5]: only active"'
bind -c hash23 2 eval 'backtick 42 3600 3600 printf " "' 'backtick 43 3600 3600 printf " "'
bind -c hash23 4 eval 'backtick 42' 'backtick 43'
bind -c hash23 5 eval 'backtick 42 3600 3600 printf " "' 'backtick 43'
bind -c hash2 4 eval 'command -c hash24' 'echo "windows on hardstatus: [3]: off, [5]: full, [6]: only active"'
bind -c hash24 4 eval 'command -c hash24' 'echo "windows on hardstatus: [3]: off, [5]: full, [6]: only active"'
bind -c hash24 3 eval 'backtick 62 3600 3600 printf " "' 'backtick 63 3600 3600 printf " "'
bind -c hash24 5 eval 'backtick 62' 'backtick 63'
bind -c hash24 6 eval 'backtick 62 3600 3600 printf " "' 'backtick 63'
bind -c hash2 5 eval 'command -c hash25' 'echo "windows as info popup: [4]: off, [6]: on"'
bind -c hash25 5 eval 'command -c hash25' 'echo "windows as info popup: [4]: off, [6]: on"'
bind -c hash25 4 eval 'bind p prev' 'bind n next'
bind -c hash25 6 eval 'bind p eval prev windows' 'bind n eval next windows'
# Clock displays.
bind -c hash 3 eval 'command -c hash3' 'echo "clock: [2]: off, [4]: full, [5]: short, [6]: unix, [7]: hex, [8]: binary, [9]: RBC, [0]: ddate, [k]: on caption, [j]: on hardstatus"'
bind -c hash3 3 eval 'command -c hash3' 'echo "clock: [2]: off, [4]: full, [5]: short, [6]: unix, [7]: hex, [8]: binary, [9]: RBC, [0]: ddate, [k]: on caption, [j]: on hardstatus"'
bind -c hash3 2 eval 'backtick 3'
bind -c hash3 4 backtick 3 1 1 date +'%a %F %R:%S UTC%:::z'
bind -c hash3 5 eval 'backtick 3 1 1 date +"%R:%S"' # simpler (shorter) clock display. Useful for small terminals.
bind -c hash3 6 eval 'backtick 3 1 1 date +"%s"' # use unix timestamp (seconds since 1970-01-01 00:00:00 UTC) for the clock display
bind -c hash3 7 eval "backtick 3 1 1 sh -c 'dc -e \"16o $(date +%s) p\"'" # unix timestamp in hexadecimal
bind -c hash3 8 eval "backtick 3 1 1 sh -c 'dc -e \"2o $(date +%s) p\"'" # unix timestamp in binary
bind -c hash3 9 eval "backtick 3 1 1 sh -c 'dc -e \"2o $(date +%s) p\"|sed -nr \"s/0/A/g;s/(\^|A)1/\\1B/g;s/(1|B)A/\\1C/g;s/(A|1)/0/g;s/(B|C)/1/gp\"'" # unix timestamp in Gray code (aka. reflected binary code, RBC), just because I can
bind -c hash3 0 backtick 3 1 1 sh -c 'echo "$(ddate +%H\ %a\ %Y-%b-%d) $(date +%R:%S\ \ UTC%:::z)"' # Discordian date!
bind -c hash3 k eval 'backtick 44' 'backtick 64 3600 3600 printf " "'
bind -c hash3 j eval 'backtick 44 3600 3600 printf " "' 'backtick 64'
# list of all active network interfaces and their IP addresses (with subnet mask). Formerly known as 'shortip'
bind -c hash 4 eval 'command -c hash4' 'echo "IP interface & address display: [3]: off, [5]: IPv4 only [6]: IPv4 & v6, [7]: IPv4 scrolling, [8]: IPv4 & v6 scrolling"'
bind -c hash4 4 eval 'command -c hash4' 'echo "IP interface & address display: [3]: off, [5]: IPv4 only [6]: IPv4 & v6, [7]: IPv4 scrolling, [8]: IPv4 & v6 scrolling"'
bind -c hash4 3 eval 'backtick 4'
bind -c hash4 5 backtick 4 10 10 sh -c 'ip -o a|sed -nr "1h;1!H;\${;g;s/([0-9]+: lo +[^\\n]+(\$|\\n)|[^\\n]+scope link[^\\n]+(\$|\\n))//g;s/[0-9]+: ([^ ]+) +inet ([0-9a-f.:]+\\/[0-9]+) [^\\n]+(\$|\\n)/\\1=\\2 /g;s/ \$//g;p;}"' #classic mode. Static display, no shenanigans.
bind -c hash4 6 backtick 4 10 10 sh -c 'ip -o a|sed -nr "1h;1!H;\${;g;s/([0-9]+: lo +[^\\n]+(\$|\\n)|[^\\n]+scope link[^\\n]+(\$|\\n))//g;s/[0-9]+: ([^ ]+) +inet6? ([0-9a-f.:]+\\/[0-9]+) [^\\n]+(\$|\\n)/\\1=\\2 /g;s/ \$//g;p;}"' #classic mode. Static display, no shenanigans.
# scrolling IP display. Set length here--------v Careful with this - If you switch this off again, the shell script will continue to run in the background. TO DO: put screen session ID in the script; kill script when switching to another mode.
bind -c hash4 7 backtick 4 0 0 bash -c 'LENGTH=15; shortip() { ip -o a|sed -nr "1h;1!H;\${;g;s/([0-9]+: lo +[^\\n]+(\$|\\n)|[^\\n]+scope link[^\\n]+(\$|\\n))//g;s/[0-9]+: ([^ ]+) +inet ([0-9a-f.:]+\\/[0-9]+) [^\\n]+(\$|\\n)/\\1=\\2 /g;s/ \$//g;p;}"; }; STRING=""; while true; do while [ ${#STRING} -lt $LENGTH ]; do STRING="$STRING $(shortip)"; done; echo "$STRING" | sed -nr "s/^(.{${LENGTH}})(.+)/\1/p"; sleep 0.5; STRING=$(echo "$STRING" | sed -nr "s/^.//p"); done'
bind -c hash4 8 backtick 4 0 0 bash -c 'LENGTH=15; shortip() { ip -o a|sed -nr "1h;1!H;\${;g;s/([0-9]+: lo +[^\\n]+(\$|\\n)|[^\\n]+scope link[^\\n]+(\$|\\n))//g;s/[0-9]+: ([^ ]+) +inet6? ([0-9a-f.:]+\\/[0-9]+) [^\\n]+(\$|\\n)/\\1=\\2 /g;s/ \$//g;p;}"; }; STRING=""; while true; do while [ ${#STRING} -lt $LENGTH ]; do STRING="$STRING $(shortip)"; done; echo "$STRING" | sed -nr "s/^(.{${LENGTH}})(.+)/\1/p"; sleep 0.5; STRING=$(echo "$STRING" | sed -nr "s/^.//p"); done'
# public IPv4 address. Formerly known as 'shortextip'. Kindly provided by freenode-user gxg. May cause lagging, therefore disabled by default.
bind -c hash 5 eval 'command -c hash5' 'echo "external IP: [4]: off, [6]: on"'
bind -c hash5 5 eval 'command -c hash5' 'echo "external IP: [4]: off, [6]: on"'
bind -c hash5 4 eval 'backtick 5'
bind -c hash5 6 backtick 5 600 600 sh -c 'EXTIP=$(curl -fs --include --request GET "https://api.duckduckgo.com/?q=ip&l=1&no_redirect=1&skip_disambig=1&format=json" | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"); if [ "$EXTIP" != "" ]; then echo " EXT=$EXTIP"; fi'
# CPU load averages. I know there's a screen string escape for that, but then it'd be harder to make it pretty and toggleable. Formerly known as 'shortload'
bind -c hash 6 eval 'command -c hash6' 'echo "cpu load: [5]: off, [7]: normal load avg, [8]: usage% per core"'
bind -c hash6 6 eval 'command -c hash6' 'echo "cpu load: [5]: off, [7]: normal load avg, [8]: usage% per core"'
bind -c hash6 5 eval 'backtick 6'
bind -c hash6 7 backtick 6 10 10 sh -c 'echo "L:$(cat /proc/loadavg |cut -d\ -f1,2,3)"'
# CPU usage for each core, updated every second. Careful with this - If you switch this off again, the shell script will continue to run in the background. If you switch it on/off a lot, you end up with a bunch of processes that eat your CPU. Kill manually until I find a better solution.
bind -c hash6 8 backtick 6 0 0 bash -c 'stat() { echo $(awk "/^cpu[0-9]+/{usage=\$2+\$3+\$4;total=usage+\$5;print total\" \"usage}" /proc/stat); };OLD=($(stat));seq=($(seq 0 1 $((${#OLD[@]}-1))));cores=($(seq 0 1 $(($((${#OLD[@]}/2))-1))));while $true; do sleep 1;NEW=($(stat));DIF=();for i in ${seq[@]}; do DIF=(${DIF[@]} $((${NEW[$i]}-${OLD[$i]})));done;PERCENTS="";for i in ${cores[@]}; do PERCENT=$(($((${DIF[$(($(($i*2))+1))]}*100))/${DIF[$(($i*2))]}));if [ $PERCENT -lt 10 ]; then PERCENTS="$PERCENTS ${PERCENT}%";elif [ $PERCENT -lt 100 ]; then PERCENTS="$PERCENTS ${PERCENT}%";else PERCENTS="${PERCENTS}100%";fi;done;echo "${PERCENTS[@]}";OLD=(${NEW[@]});done'
# RAM and swap usage. Formerly known as 'shortmem'
bind -c hash 7 eval 'command -c hash7' 'echo "RAM & swap: [6]: off, [8]: on"'
bind -c hash7 7 eval 'command -c hash7' 'echo "RAM & swap: [6]: off, [8]: on"'
bind -c hash7 6 eval 'backtick 7'
bind -c hash7 8 backtick 7 10 10 sh -c 'awk "/^MemTotal:/{mt=\$2};/^MemFree:/{mf=\$2};/^Buffers:/{b=\$2};/^Cached:/{c=\$2};/^SwapTotal:/{st=\$2};/^SwapFree:/{sf=\$2;print\"M:\"int((mt-mf-b-c)/1024)\"/\"int(mt/1024)\" S:\"int((st-sf)/1024)\"/\"int(st/1024)}" /proc/meminfo'
# disk space usage.
bind -c hash 8 eval 'command -c hash8' 'echo "disk space usage: [7]: off, [9]: on"'
bind -c hash8 8 eval 'command -c hash8' 'echo "disk space usage: [7]: off, [9]: on"'
bind -c hash8 7 eval 'backtick 8'
# List of filesystems here-------------------------v
bind -c hash8 9 backtick 8 600 600 bash -c 'DEVS=( /boot / ); echo $(for DEV in ${DEVS[@]}; do df -hl $DEV |awk "NR==2"; done) |sed -nr "1h;1!H;\${;g;s/[^ ]+ +([0-9]+[,.]?[0-9]*[BKMGT]?) +([0-9]+[,.]?[0-9]*[BKMGT]?) +[0-9]+[,.]?[0-9]*[BKMGT]? +[0-9]+% +(\/[^ ]*)/\3:\2\/\1/g;p;}"'
# battery charge. Formerly known as 'shortbatt'
bind -c hash 9 eval 'command -c hash9' 'echo "battery charge: [8]: off, [0] on"'
bind -c hash9 9 eval 'command -c hash9' 'echo "battery charge: [8]: off, [0] on"'
bind -c hash9 8 eval 'backtick 9'
bind -c hash9 0 backtick 9 60 60 sh -c 'SHORTBATT=$(acpi|cut -d\ -f4,5); if [ "$SHORTBATT" != "" ]; then echo "B:$SHORTBATT"; fi'
# stuff that affects whole bars
bind -c hash 0 eval 'command -c hash0' 'echo "bars: [k]: caption bar, [j]: hardstatus, [123456789]: flavours, [dD]: set/select defaults"'
bind -c hash0 0 eval 'command -c hash0' 'echo "bars: [k]: caption bar, [j]: hardstatus, [123456789]: flavours, [dD]: set/select defaults"'
bind -c hash0k '#' eval 'command -c hash0' 'echo "bars: [k]: caption bar, [j]: hardstatus, [123456789]: flavours, [dD]: set/select defaults"'
bind -c hash0j '#' eval 'command -c hash0' 'echo "bars: [k]: caption bar, [j]: hardstatus, [123456789]: flavours, [dD]: set/select defaults"'
bind -c hash0D '#' eval 'command -c hash0' 'echo "bars: [k]: caption bar, [j]: hardstatus, [123456789]: flavours, [dD]: set/select defaults"'
bind -c hash0 k eval 'command -c hash0k' 'echo "caption: [0]: splitonly, [1]: always"'
bind -c hash0k k eval 'command -c hash0k' 'echo "caption: [0]: splitonly, [1]: always"'
bind -c hash0k 0 caption splitonly # show caption line only on split layouts
bind -c hash0k 1 caption always
bind -c hash0 j eval 'command -c hash0j' 'echo "hardstatus: [0]: alwaysignore, [1]: lastline, [2]: firstline"'
bind -c hash0j j eval 'command -c hash0j' 'echo "hardstatus: [0]: alwaysignore, [1]: lastline, [2]: firstline"'
bind -c hash0j 0 hardstatus alwaysignore # hide hardstatus
bind -c hash0j 1 hardstatus lastline # hardstatus on the bottom
bind -c hash0j 2 hardstatus firstline # hardstatus at the top
# flavours. Should be easy enough to add your own.
bind -c hash0 1 eval 'xoff' 'register : "^A#0k1^A#0j1^A#1k^A#12^A#234^A#243^A#254^A#3k^A#34^A#46^A#54^A#67^A#78^A#89^A#90^A!:0"' 'process :' 'xon' # all the goodies except extIP. Good for outermost session
bind -c hash0 2 eval 'xoff' 'register : "^A#0k1^A#0j1^A#1k^A#12^A#234^A#243^A#254^A#3k^A#32^A#43^A#54^A#65^A#76^A#87^A#98^A!:0"' 'process :' 'xon' # info items on hardstatus removed. Good for nested sessions on the same machine, to minimize redundant execution.
bind -c hash0 3 eval 'xoff' 'register : "^A#0k0^A#0j1^A#1j^A#13^A#235^A#245^A#254^A#3j^A#35^A#46^A#54^A#67^A#78^A#89^A#90^A!:1"' 'process :' 'xon' # all the goodies on the hardstatus, only current window title on caption. Good for split layouts; needs a large terminal to actually display all the stuff.
bind -c hash0 4 eval 'xoff' 'register : "^A#0k0^A#0j1^A#1j^A#13^A#235^A#245^A#254^A#3j^A#32^A#43^A#54^A#65^A#76^A#87^A#98^A!:1"' 'process :' 'xon' # same as above, except most info items are off. Good for split layouts on smaller terminals.
bind -c hash0 5
bind -c hash0 6
bind -c hash0 7
bind -c hash0 8
bind -c hash0 9 eval 'xoff' 'register : "^A#0k0^A#0j0^A#1k^A#12^A#234^A#243^A#256^A#3k^A#32^A#43^A#54^A#65^A#76^A#87^A#98^A!:0"' 'process :' 'xon' # hide hardstatus & caption
bind -c hash0 d eval 'register : "^A#01"' 'process :' # default default
bind -c hash0 D eval 'command -c hash0D' 'echo "select default statusbar flavour for presets: [123456789]"'
bind -c hash0D D eval 'command -c hash0D' 'echo "select default statusbar flavour for presets: [123456789]"'
bind -c hash0D 1 bind -c hash0 d eval 'register : "^A#01"' 'process :'
bind -c hash0D 2 bind -c hash0 d eval 'register : "^A#02"' 'process :'
bind -c hash0D 3 bind -c hash0 d eval 'register : "^A#03"' 'process :'
bind -c hash0D 4 bind -c hash0 d eval 'register : "^A#04"' 'process :'
bind -c hash0D 5 bind -c hash0 d eval 'register : "^A#05"' 'process :'
bind -c hash0D 6 bind -c hash0 d eval 'register : "^A#06"' 'process :'
bind -c hash0D 7 bind -c hash0 d eval 'register : "^A#07"' 'process :'
bind -c hash0D 8 bind -c hash0 d eval 'register : "^A#08"' 'process :'
bind -c hash0D 9 bind -c hash0 d eval 'register : "^A#09"' 'process :'
# this selects the default flavour
eval 'register : "^A#0d"' 'process :'
# Colors
# usage: press ^A#[roygcbmwROYGCBMW] to change the color. Capital letters produce an inverted color scheme (black foreground, colored background), for a whooping 16 variants total.
# [Ii] switch from normal to inverted and vice versa, respectively, without changing the color
# if y ('dark yellow', used here as orange) is an ugly brown on your terminal, then change your terminal's color settings. Srsly, brown on a terminal is ugly as shit.
# caption color goes here-----v hardstatus color goes here-----v
bind -c hash r eval 'caption string "%{= kw}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{R}%{=b kW}%?%PCopy mode %?%{-}%?%E%{+r}%?%?%41`%:%23`%1`%25`%{-r} %?%{-r}%?%42`%:%-Lw%?%?%43`%:%{+r}%n%f %t%{-r}%?%?%42`%:%+Lw%? %=%?%44`%:%3` %?%{= kw}%{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{= kw}%21`%22`_%{=b kW}%20`%{-}%{R}%?%E%{+r}%?%?%61`%: %23`%1`%25`%?%{-r} %?%62`%:%-Lw%?%?%63`%:%{+r}%n%f %t%{-r}%?%?%62`%:%+Lw%?%=%24`@%H%?%{w}|%{-}%4`%5`%?%?%{w}|%{-}%6`%?%?%{w}|%{-}%7`%?%?%{w}|%{-}%8`%?%?%{w}|%{-}%9`%?%=%?%64`%:%3`%?%{w}_%22`%21`"' 'bind -c hash I eval "register : ^A#R" "process :"' 'bind -c hash i'
bind -c hash o eval 'caption string "%{= kw}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{y}%{=b kW}%?%PCopy mode %?%{-}%?%E%{+r}%?%?%41`%:%23`%1`%25`%{-r} %?%{-r}%?%42`%:%-Lw%?%?%43`%:%{+r}%n%f %t%{-r}%?%?%42`%:%+Lw%? %=%?%44`%:%3` %?%{= kw}%{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{= kw}%21`%22`_%{=b kW}%20`%{-}%{y}%?%E%{+r}%?%?%61`%: %23`%1`%25`%?%{-r} %?%62`%:%-Lw%?%?%63`%:%{+r}%n%f %t%{-r}%?%?%62`%:%+Lw%?%=%24`@%H%?%{w}|%{-}%4`%5`%?%?%{w}|%{-}%6`%?%?%{w}|%{-}%7`%?%?%{w}|%{-}%8`%?%?%{w}|%{-}%9`%?%=%?%64`%:%3`%?%{w}_%22`%21`"' 'bind -c hash I eval "register : ^A#O" "process :"' 'bind -c hash i'
bind -c hash y eval 'caption string "%{= kw}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{Y}%{=b kW}%?%PCopy mode %?%{-}%?%E%{+r}%?%?%41`%:%23`%1`%25`%{-r} %?%{-r}%?%42`%:%-Lw%?%?%43`%:%{+r}%n%f %t%{-r}%?%?%42`%:%+Lw%? %=%?%44`%:%3` %?%{= kw}%{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{= kw}%21`%22`_%{=b kW}%20`%{-}%{Y}%?%E%{+r}%?%?%61`%: %23`%1`%25`%?%{-r} %?%62`%:%-Lw%?%?%63`%:%{+r}%n%f %t%{-r}%?%?%62`%:%+Lw%?%=%24`@%H%?%{w}|%{-}%4`%5`%?%?%{w}|%{-}%6`%?%?%{w}|%{-}%7`%?%?%{w}|%{-}%8`%?%?%{w}|%{-}%9`%?%=%?%64`%:%3`%?%{w}_%22`%21`"' 'bind -c hash I eval "register : ^A#Y" "process :"' 'bind -c hash i'
bind -c hash g eval 'caption string "%{= kw}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{G}%{=b kW}%?%PCopy mode %?%{-}%?%E%{+r}%?%?%41`%:%23`%1`%25`%{-r} %?%{-r}%?%42`%:%-Lw%?%?%43`%:%{+r}%n%f %t%{-r}%?%?%42`%:%+Lw%? %=%?%44`%:%3` %?%{= kw}%{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{= kw}%21`%22`_%{=b kW}%20`%{-}%{G}%?%E%{+r}%?%?%61`%: %23`%1`%25`%?%{-r} %?%62`%:%-Lw%?%?%63`%:%{+r}%n%f %t%{-r}%?%?%62`%:%+Lw%?%=%24`@%H%?%{w}|%{-}%4`%5`%?%?%{w}|%{-}%6`%?%?%{w}|%{-}%7`%?%?%{w}|%{-}%8`%?%?%{w}|%{-}%9`%?%=%?%64`%:%3`%?%{w}_%22`%21`"' 'bind -c hash I eval "register : ^A#G" "process :"' 'bind -c hash i'
bind -c hash c eval 'caption string "%{= kw}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{C}%{=b kW}%?%PCopy mode %?%{-}%?%E%{+r}%?%?%41`%:%23`%1`%25`%{-r} %?%{-r}%?%42`%:%-Lw%?%?%43`%:%{+r}%n%f %t%{-r}%?%?%42`%:%+Lw%? %=%?%44`%:%3` %?%{= kw}%{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{= kw}%21`%22`_%{=b kW}%20`%{-}%{C}%?%E%{+r}%?%?%61`%: %23`%1`%25`%?%{-r} %?%62`%:%-Lw%?%?%63`%:%{+r}%n%f %t%{-r}%?%?%62`%:%+Lw%?%=%24`@%H%?%{w}|%{-}%4`%5`%?%?%{w}|%{-}%6`%?%?%{w}|%{-}%7`%?%?%{w}|%{-}%8`%?%?%{w}|%{-}%9`%?%=%?%64`%:%3`%?%{w}_%22`%21`"' 'bind -c hash I eval "register : ^A#C" "process :"' 'bind -c hash i'
bind -c hash b eval 'caption string "%{= kw}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{B}%{=b kW}%?%PCopy mode %?%{-}%?%E%{+r}%?%?%41`%:%23`%1`%25`%{-r} %?%{-r}%?%42`%:%-Lw%?%?%43`%:%{+r}%n%f %t%{-r}%?%?%42`%:%+Lw%? %=%?%44`%:%3` %?%{= kw}%{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{= kw}%21`%22`_%{=b kW}%20`%{-}%{B}%?%E%{+r}%?%?%61`%: %23`%1`%25`%?%{-r} %?%62`%:%-Lw%?%?%63`%:%{+r}%n%f %t%{-r}%?%?%62`%:%+Lw%?%=%24`@%H%?%{w}|%{-}%4`%5`%?%?%{w}|%{-}%6`%?%?%{w}|%{-}%7`%?%?%{w}|%{-}%8`%?%?%{w}|%{-}%9`%?%=%?%64`%:%3`%?%{w}_%22`%21`"' 'bind -c hash I eval "register : ^A#B" "process :"' 'bind -c hash i'
bind -c hash m eval 'caption string "%{= kw}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{M}%{=b kW}%?%PCopy mode %?%{-}%?%E%{+r}%?%?%41`%:%23`%1`%25`%{-r} %?%{-r}%?%42`%:%-Lw%?%?%43`%:%{+r}%n%f %t%{-r}%?%?%42`%:%+Lw%? %=%?%44`%:%3` %?%{= kw}%{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{= kw}%21`%22`_%{=b kW}%20`%{-}%{M}%?%E%{+r}%?%?%61`%: %23`%1`%25`%?%{-r} %?%62`%:%-Lw%?%?%63`%:%{+r}%n%f %t%{-r}%?%?%62`%:%+Lw%?%=%24`@%H%?%{w}|%{-}%4`%5`%?%?%{w}|%{-}%6`%?%?%{w}|%{-}%7`%?%?%{w}|%{-}%8`%?%?%{w}|%{-}%9`%?%=%?%64`%:%3`%?%{w}_%22`%21`"' 'bind -c hash I eval "register : ^A#M" "process :"' 'bind -c hash i'
bind -c hash w eval 'caption string "%{= kw}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{W}%{=b kW}%?%PCopy mode %?%{-}%?%E%{+r}%?%?%41`%:%23`%1`%25`%{-r} %?%{-r}%?%42`%:%-Lw%?%?%43`%:%{+r}%n%f %t%{-r}%?%?%42`%:%+Lw%? %=%?%44`%:%3` %?%{= kw}%{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{= kw}%21`%22`_%{=b kW}%20`%{-}%{W}%?%E%{+r}%?%?%61`%: %23`%1`%25`%?%{-r} %?%62`%:%-Lw%?%?%63`%:%{+r}%n%f %t%{-r}%?%?%62`%:%+Lw%?%=%24`@%H%?%{w}|%{-}%4`%5`%?%?%{w}|%{-}%6`%?%?%{w}|%{-}%7`%?%?%{w}|%{-}%8`%?%?%{w}|%{-}%9`%?%=%?%64`%:%3`%?%{w}_%22`%21`"' 'bind -c hash I eval "register : ^A#W" "process :"' 'bind -c hash i'
# inverted color schemes
# caption color goes here-----v hardstatus color goes here-----v
bind -c hash R eval 'caption string "%{! kr}%{-b}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{=b kW}%?%P Copy mode %?%{-}%?%E%{=b kI}%?%?%41`%:%23`%1`%25`%?%?%E%{-} %: %?%?%42`%:%-Lw%?%?%43`%:%{= I}%n%f %t%{-}%?%?%42`%:%+Lw%? %=%?%44`%:%3`%? %{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{!r kr}%{-b}%21`%22`_%{=b kW}%20`%{-}%?%E%{=b kI}%?%?%61`%:%23`%1`%25`%?%?%E%{-}%? %?%62`%:%-Lw%?%?%63`%:%{= I}%n%f %t%{-}%?%?%62`%:%+Lw%?%=%24`@%H%?|%4`%5`%?%?|%6`%?%?|%7`%?%?|%8`%?%?|%9`%?%=%?%64`%:%3`%?_%22`%21`"' 'bind -c hash i eval "register : ^A#r" "process :"' 'bind -c hash I'
bind -c hash O eval 'caption string "%{! ky}%{-b}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{=b kW}%?%P Copy mode %?%{-}%?%E%{=b kI}%?%?%41`%:%23`%1`%25`%?%?%E%{-} %: %?%?%42`%:%-Lw%?%?%43`%:%{= i}%n%f %t%{-}%?%?%42`%:%+Lw%? %=%?%44`%:%3`%? %{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{!r ky}%{-b}%21`%22`_%{=b kW}%20`%{-}%?%E%{=b kI}%?%?%61`%:%23`%1`%25`%?%?%E%{-}%? %?%62`%:%-Lw%?%?%63`%:%{= i}%n%f %t%{-}%?%?%62`%:%+Lw%?%=%24`@%H%?|%4`%5`%?%?|%6`%?%?|%7`%?%?|%8`%?%?|%9`%?%=%?%64`%:%3`%?_%22`%21`"' 'bind -c hash i eval "register : ^A#o" "process :"' 'bind -c hash I'
bind -c hash Y eval 'caption string "%{! kY}%{-b}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{=b kW}%?%P Copy mode %?%{-}%?%E%{=b kI}%?%?%41`%:%23`%1`%25`%?%?%E%{-} %: %?%?%42`%:%-Lw%?%?%43`%:%{= I}%n%f %t%{-}%?%?%42`%:%+Lw%? %=%?%44`%:%3`%? %{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{!r kY}%{-b}%21`%22`_%{=b kW}%20`%{-}%?%E%{=b kI}%?%?%61`%:%23`%1`%25`%?%?%E%{-}%? %?%62`%:%-Lw%?%?%63`%:%{= I}%n%f %t%{-}%?%?%62`%:%+Lw%?%=%24`@%H%?|%4`%5`%?%?|%6`%?%?|%7`%?%?|%8`%?%?|%9`%?%=%?%64`%:%3`%?_%22`%21`"' 'bind -c hash i eval "register : ^A#y" "process :"' 'bind -c hash I'
bind -c hash G eval 'caption string "%{! kG}%{-b}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{=b kW}%?%P Copy mode %?%{-}%?%E%{=b kI}%?%?%41`%:%23`%1`%25`%?%?%E%{-} %: %?%?%42`%:%-Lw%?%?%43`%:%{= I}%n%f %t%{-}%?%?%42`%:%+Lw%? %=%?%44`%:%3`%? %{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{!r kG}%{-b}%21`%22`_%{=b kW}%20`%{-}%?%E%{=b kI}%?%?%61`%:%23`%1`%25`%?%?%E%{-}%? %?%62`%:%-Lw%?%?%63`%:%{= I}%n%f %t%{-}%?%?%62`%:%+Lw%?%=%24`@%H%?|%4`%5`%?%?|%6`%?%?|%7`%?%?|%8`%?%?|%9`%?%=%?%64`%:%3`%?_%22`%21`"' 'bind -c hash i eval "register : ^A#g" "process :"' 'bind -c hash I'
bind -c hash C eval 'caption string "%{! kc}%{-b}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{=b kW}%?%P Copy mode %?%{-}%?%E%{=b kI}%?%?%41`%:%23`%1`%25`%?%?%E%{-} %: %?%?%42`%:%-Lw%?%?%43`%:%{= I}%n%f %t%{-}%?%?%42`%:%+Lw%? %=%?%44`%:%3`%? %{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{!r kc}%{-b}%21`%22`_%{=b kW}%20`%{-}%?%E%{=b kI}%?%?%61`%:%23`%1`%25`%?%?%E%{-}%? %?%62`%:%-Lw%?%?%63`%:%{= I}%n%f %t%{-}%?%?%62`%:%+Lw%?%=%24`@%H%?|%4`%5`%?%?|%6`%?%?|%7`%?%?|%8`%?%?|%9`%?%=%?%64`%:%3`%?_%22`%21`"' 'bind -c hash i eval "register : ^A#c" "process :"' 'bind -c hash I'
bind -c hash B eval 'caption string "%{! kB}%{-b}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{=b kW}%?%P Copy mode %?%{-}%?%E%{=b kI}%?%?%41`%:%23`%1`%25`%?%?%E%{-} %: %?%?%42`%:%-Lw%?%?%43`%:%{= I}%n%f %t%{-}%?%?%42`%:%+Lw%? %=%?%44`%:%3`%? %{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{!r kB}%{-b}%21`%22`_%{=b kW}%20`%{-}%?%E%{=b kI}%?%?%61`%:%23`%1`%25`%?%?%E%{-}%? %?%62`%:%-Lw%?%?%63`%:%{= I}%n%f %t%{-}%?%?%62`%:%+Lw%?%=%24`@%H%?|%4`%5`%?%?|%6`%?%?|%7`%?%?|%8`%?%?|%9`%?%=%?%64`%:%3`%?_%22`%21`"' 'bind -c hash i eval "register : ^A#b" "process :"' 'bind -c hash I'
bind -c hash M eval 'caption string "%{! km}%{-b}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{=b kW}%?%P Copy mode %?%{-}%?%E%{=b kI}%?%?%41`%:%23`%1`%25`%?%?%E%{-} %: %?%?%42`%:%-Lw%?%?%43`%:%{= I}%n%f %t%{-}%?%?%42`%:%+Lw%? %=%?%44`%:%3`%? %{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{!r km}%{-b}%21`%22`_%{=b kW}%20`%{-}%?%E%{=b kI}%?%?%61`%:%23`%1`%25`%?%?%E%{-}%? %?%62`%:%-Lw%?%?%63`%:%{= I}%n%f %t%{-}%?%?%62`%:%+Lw%?%=%24`@%H%?|%4`%5`%?%?|%6`%?%?|%7`%?%?|%8`%?%?|%9`%?%=%?%64`%:%3`%?_%22`%21`"' 'bind -c hash i eval "register : ^A#m" "process :"' 'bind -c hash I'
bind -c hash W eval 'caption string "%{! kW}%{-b}%21`%{+B}%?%F%:%{-B}%?%22`%{-B} %{=b kW}%?%P Copy mode %?%{-}%?%E%{=b kI}%?%?%41`%:%23`%1`%25`%?%?%E%{-} %: %?%?%42`%:%-Lw%?%?%43`%:%{= I}%n%f %t%{-}%?%?%42`%:%+Lw%? %=%?%44`%:%3`%? %{+B}%?%F%:%{-B}%?%22`%{-B}%21`"' 'hardstatus string "%{!r kW}%{-b}%21`%22`_%{=b kW}%20`%{-}%?%E%{=b kI}%?%?%61`%:%23`%1`%25`%?%?%E%{-}%? %?%62`%:%-Lw%?%?%63`%:%{= I}%n%f %t%{-}%?%?%62`%:%+Lw%?%=%24`@%H%?|%4`%5`%?%?|%6`%?%?|%7`%?%?|%8`%?%?|%9`%?%=%?%64`%:%3`%?_%22`%21`"' 'bind -c hash i eval "register : ^A#w" "process :"' 'bind -c hash I'
# coloring cmds, messages, the selected text in copy mode & region borders
# usage: ^A![roygcbmwROYGCBMW]
bind -c exclam r eval 'rendition so Rk' 'redisplay'
bind -c exclam o eval 'rendition so yk' 'redisplay'
bind -c exclam y eval 'rendition so Yk' 'redisplay'
bind -c exclam g eval 'rendition so Gk' 'redisplay'
bind -c exclam c eval 'rendition so Ck' 'redisplay'
bind -c exclam b eval 'rendition so Bk' 'redisplay'
bind -c exclam m eval 'rendition so Mk' 'redisplay'
bind -c exclam w eval 'rendition so Wk' 'redisplay'
bind -c exclam R eval 'rendition so kr' 'redisplay'
bind -c exclam O eval 'rendition so ky' 'redisplay'
bind -c exclam Y eval 'rendition so kY' 'redisplay'
bind -c exclam G eval 'rendition so kG' 'redisplay'
bind -c exclam C eval 'rendition so kc' 'redisplay'
bind -c exclam B eval 'rendition so kB' 'redisplay'
bind -c exclam M eval 'rendition so km' 'redisplay'
bind -c exclam W eval 'rendition so kW' 'redisplay'
# color initialization is done simply by sending the desired key bindings to screen. Define here:
eval 'register : "^A#c^A!C"' 'process :'
### cyclable presets ###
# quite possibly the craziest shit yet: the following jumbled mess is intended for accociating certain status bar (or other) settings with certain layouts, AND to cycle through these presets just as easily as you cycle through windows.
# The way this is done is with 10 registers (limited to 10, because if you have more than 10 layouts in a single screen session, you're crazier than I am), which simply contain the keystrokes you'd have to press in order to change the statusbar & switch the layout manually.
# usage:
# create/change a preset: ^A;+[0-9]
# You're prompted to fill a register; defaults are something like that: ^A#i^A#0d^A/0, which means: ^A#i: use normal colors (not inverted), ^A#01 use the default statusbar flavour, ^A/0 switch to layout 0
# so if you, for example, want to set up a preset that inverts the color scheme and uses flavour 3 for the status bar (good setup for split layous), and then switches to layout 2,
# you'd press: ^A;+2
# and then change the keystroke sequence to: ^A#I^A#03^A/2
# Note that this doesn't create a new layout! You have to do that separately!
#
# delete a preset: ^A;-[0-9]
# non-existent presets are skipped over when cycling, just like windows!
#
# select a preset directly: ^A;[0-9]
#
# cycle through presets (both directions): ^A;[pn]
# OR simply press Shift+F-key, using the same F-keys you use to switch between windows on the nesting depth you're on! That's the fun part!
bind ; eval 'command -c semi' 'echo "presets: [+]: create/change preset, [-]: delete preset, [0-9]: select preset, [pn]: cycle through presets"'
bind -c semi ; eval 'command -c semi' 'echo "presets: [+]: create/change preset, [-]: delete preset, [0-9]: select preset, [pn]: cycle through presets"'
bind -c semiplus ; eval 'command -c semi' 'echo "presets: [+]: create/change preset, [-]: delete preset, [0-9]: select preset, [pn]: cycle through presets"'
bind -c semiminus ; eval 'command -c semi' 'echo "presets: [+]: create/change preset, [-]: delete preset, [0-9]: select preset, [pn]: cycle through presets"'
register 0 "^A#i^A#0d^A/0"
bind -c semi 0 eval 'bind -c semi p eval "register : ^A;P9" "process :"' 'bind -c semi n eval "register : ^A;N1" "process :"' 'backtick 25 3600 3600 printf " p0:"' 'process 0'
bind -c semi p eval 'register : ^A;P9' 'process :'
bind -c semi n eval 'register : ^A;N1' 'process :'
bind -c semi P command -c semiP
bind -c semiP 0 eval 'register : "^A;0"' 'process :'
bind -c semiP 1 eval 'register : "^A;P0"' 'process :'
bind -c semiP 2 eval 'register : "^A;P1"' 'process :'
bind -c semiP 3 eval 'register : "^A;P2"' 'process :'
bind -c semiP 4 eval 'register : "^A;P3"' 'process :'
bind -c semiP 5 eval 'register : "^A;P4"' 'process :'
bind -c semiP 6 eval 'register : "^A;P5"' 'process :'
bind -c semiP 7 eval 'register : "^A;P6"' 'process :'
bind -c semiP 8 eval 'register : "^A;P7"' 'process :'
bind -c semiP 9 eval 'register : "^A;P8"' 'process :'
bind -c semi N command -c semiN
bind -c semiN 0 eval 'register : "^A;0"' 'process :'
bind -c semiN 1 eval 'register : "^A;N2"' 'process :'
bind -c semiN 2 eval 'register : "^A;N3"' 'process :'
bind -c semiN 3 eval 'register : "^A;N4"' 'process :'
bind -c semiN 4 eval 'register : "^A;N5"' 'process :'
bind -c semiN 5 eval 'register : "^A;N6"' 'process :'
bind -c semiN 6 eval 'register : "^A;N7"' 'process :'
bind -c semiN 7 eval 'register : "^A;N8"' 'process :'
bind -c semiN 8 eval 'register : "^A;N9"' 'process :'
bind -c semiN 9 eval 'register : "^A;N0"' 'process :'
bind -c semi + eval 'command -c semiplus' 'echo "[0-9]: create preset; edit keystroke sequence in next step"'
bind -c semiplus + eval 'command -c semiplus' 'echo "[0-9]: create preset; edit keystroke sequence in next step"'
bind -c semiplus 0 eval 'bind -c semiP 0 eval "register : ^A;0" "process :"' 'bind -c semiN 0 eval "register : ^A;0" "process :"' 'register : "^A:register 0 \^A#i\^A#0d\^A/0"' 'process :' 'bind -c semi 0 eval "bind -c semi p eval \"register : \^A;P9\" \"process :\"" "bind -c semi n eval \"register : \^A;N1\" \"process :\"" "backtick 25 3600 3600 printf \" p0:\"" "process 0"'
bind -c semiplus 1 eval 'bind -c semiP 1 eval "register : ^A;1" "process :"' 'bind -c semiN 1 eval "register : ^A;1" "process :"' 'register : "^A:register 1 \^A#i\^A#0d\^A/1"' 'process :' 'bind -c semi 1 eval "bind -c semi p eval \"register : \^A;P0\" \"process :\"" "bind -c semi n eval \"register : \^A;N2\" \"process :\"" "backtick 25 3600 3600 printf \" p1:\"" "process 1"'
bind -c semiplus 2 eval 'bind -c semiP 2 eval "register : ^A;2" "process :"' 'bind -c semiN 2 eval "register : ^A;2" "process :"' 'register : "^A:register 2 \^A#i\^A#0d\^A/2"' 'process :' 'bind -c semi 2 eval "bind -c semi p eval \"register : \^A;P1\" \"process :\"" "bind -c semi n eval \"register : \^A;N3\" \"process :\"" "backtick 25 3600 3600 printf \" p2:\"" "process 2"'
bind -c semiplus 3 eval 'bind -c semiP 3 eval "register : ^A;3" "process :"' 'bind -c semiN 3 eval "register : ^A;3" "process :"' 'register : "^A:register 3 \^A#i\^A#0d\^A/3"' 'process :' 'bind -c semi 3 eval "bind -c semi p eval \"register : \^A;P2\" \"process :\"" "bind -c semi n eval \"register : \^A;N4\" \"process :\"" "backtick 25 3600 3600 printf \" p3:\"" "process 3"'
bind -c semiplus 4 eval 'bind -c semiP 4 eval "register : ^A;4" "process :"' 'bind -c semiN 4 eval "register : ^A;4" "process :"' 'register : "^A:register 4 \^A#i\^A#0d\^A/4"' 'process :' 'bind -c semi 4 eval "bind -c semi p eval \"register : \^A;P3\" \"process :\"" "bind -c semi n eval \"register : \^A;N5\" \"process :\"" "backtick 25 3600 3600 printf \" p4:\"" "process 4"'
bind -c semiplus 5 eval 'bind -c semiP 5 eval "register : ^A;5" "process :"' 'bind -c semiN 5 eval "register : ^A;5" "process :"' 'register : "^A:register 5 \^A#i\^A#0d\^A/5"' 'process :' 'bind -c semi 5 eval "bind -c semi p eval \"register : \^A;P4\" \"process :\"" "bind -c semi n eval \"register : \^A;N6\" \"process :\"" "backtick 25 3600 3600 printf \" p5:\"" "process 5"'
bind -c semiplus 6 eval 'bind -c semiP 6 eval "register : ^A;6" "process :"' 'bind -c semiN 6 eval "register : ^A;6" "process :"' 'register : "^A:register 6 \^A#i\^A#0d\^A/6"' 'process :' 'bind -c semi 6 eval "bind -c semi p eval \"register : \^A;P5\" \"process :\"" "bind -c semi n eval \"register : \^A;N7\" \"process :\"" "backtick 25 3600 3600 printf \" p6:\"" "process 6"'
bind -c semiplus 7 eval 'bind -c semiP 7 eval "register : ^A;7" "process :"' 'bind -c semiN 7 eval "register : ^A;7" "process :"' 'register : "^A:register 7 \^A#i\^A#0d\^A/7"' 'process :' 'bind -c semi 7 eval "bind -c semi p eval \"register : \^A;P6\" \"process :\"" "bind -c semi n eval \"register : \^A;N8\" \"process :\"" "backtick 25 3600 3600 printf \" p7:\"" "process 7"'
bind -c semiplus 8 eval 'bind -c semiP 8 eval "register : ^A;8" "process :"' 'bind -c semiN 8 eval "register : ^A;8" "process :"' 'register : "^A:register 8 \^A#i\^A#0d\^A/8"' 'process :' 'bind -c semi 8 eval "bind -c semi p eval \"register : \^A;P7\" \"process :\"" "bind -c semi n eval \"register : \^A;N9\" \"process :\"" "backtick 25 3600 3600 printf \" p8:\"" "process 8"'
bind -c semiplus 9 eval 'bind -c semiP 9 eval "register : ^A;9" "process :"' 'bind -c semiN 9 eval "register : ^A;9" "process :"' 'register : "^A:register 9 \^A#i\^A#0d\^A/9"' 'process :' 'bind -c semi 9 eval "bind -c semi p eval \"register : \^A;P8\" \"process :\"" "bind -c semi n eval \"register : \^A;N0\" \"process :\"" "backtick 25 3600 3600 printf \" p9:\"" "process 9"'
bind -c semi - eval 'command -c semiminus' 'echo "[1-9]: delete preset [0]: only remove preset display in status bar. Preset 0 should not be deleted"'
bind -c semiminus - eval 'command -c semiminus' 'echo "[1-9]: delete preset [0]: only remove preset display in status bar. Preset 0 should not be deleted"'
bind -c semiminus 0 backtick 25
bind -c semiminus 1 eval 'bind -c semiP 1 eval "register : ^A;P0" "process :"' 'bind -c semiN 1 eval "register : ^A;N2" "process :"' 'bind -c semi 1'
bind -c semiminus 2 eval 'bind -c semiP 2 eval "register : ^A;P1" "process :"' 'bind -c semiN 2 eval "register : ^A;N3" "process :"' 'bind -c semi 2'
bind -c semiminus 3 eval 'bind -c semiP 3 eval "register : ^A;P2" "process :"' 'bind -c semiN 3 eval "register : ^A;N4" "process :"' 'bind -c semi 3'
bind -c semiminus 4 eval 'bind -c semiP 4 eval "register : ^A;P3" "process :"' 'bind -c semiN 4 eval "register : ^A;N5" "process :"' 'bind -c semi 4'
bind -c semiminus 5 eval 'bind -c semiP 5 eval "register : ^A;P4" "process :"' 'bind -c semiN 5 eval "register : ^A;N6" "process :"' 'bind -c semi 5'
bind -c semiminus 6 eval 'bind -c semiP 6 eval "register : ^A;P5" "process :"' 'bind -c semiN 6 eval "register : ^A;N7" "process :"' 'bind -c semi 6'
bind -c semiminus 7 eval 'bind -c semiP 7 eval "register : ^A;P6" "process :"' 'bind -c semiN 7 eval "register : ^A;N8" "process :"' 'bind -c semi 7'
bind -c semiminus 8 eval 'bind -c semiP 8 eval "register : ^A;P7" "process :"' 'bind -c semiN 8 eval "register : ^A;N9" "process :"' 'bind -c semi 8'
bind -c semiminus 9 eval 'bind -c semiP 9 eval "register : ^A;P8" "process :"' 'bind -c semiN 9 eval "register : ^A;N0" "process :"' 'bind -c semi 9'
# this implements a neat little curses ssh session manager (dependency: dialog). It parses your ~/.ssh/config, so it doesn't require any additional configuration (except maybe a .dialogrc, because dialog's default colors cause eye cancer).
bind ~ exec bash -c 'filter="1h;1!H;\${;g;s/(^|\n)[^\n]*cannot change locale[^\n]*\n|\n*\s*\$//g;s/^[^\n]+\n|\n[^\n]+\$//g;s/(^|\n)\t/\1/g;s/[\t ]/_/g;p}";screen -X title ssh-manager;while true;do exec 3>&1;r=$(dialog --scrollbar --begin 0 0 --no-items --ok-label "connect" --extra-button --extra-label "reload" --cancel-label "exit" --menu "ssh manager" 0 0 0 "localhost (no ssh)" $(grep -E "^ *Host +[^!?*,]+\$" .ssh/config | sed -nr "1h;1!H;\${;g;s/(^|\n) *Host +/ /g;p}") "[custom]" 2>&1 1>&3);xh=$?;exec 3>&-;if [ $xh -eq 0 ];then if [[ "$r" == "localhost (no ssh)" ]];then ss=$(screen -ls |sed -nr "$filter");exec 3>&1;s=$(dialog --scrollbar --begin 0 0 --no-items --ok-label "connect" --cancel-label "cancel" --menu "screen sessions" 0 0 0 "new screen" $ss "just bash" 2>&1 1>&3);xs=$?;exec 3>&-;if [ $xs -eq 0 ];then if [[ "$s" == "just bash" ]];then screen -X screen bash -c "bash";elif [[ "$s" == "new screen" ]];then screen -X screen -t localhost screen -m;else screen -X screen -t $(echo $s |sed -nr "s/_\(.+\)//p") screen -dRR $(echo $s|sed -nr "s/^([0-9]+)\..+/\1/p");fi;fi;elif [[ "$r" != "" ]];then if [[ "$r" == "[custom]" ]]; then exec 3>&1;r=$(dialog --begin 0 0 --inputbox "IP/hostname:" 0 0 2>&1 1>&3);exec 3>&-;fi;ss=$(ssh -t $r screen -ls |sed -nr "$filter");exec 3>&1;s=$(dialog --scrollbar --begin 0 0 --no-items --ok-label "connect" --cancel-label "cancel" --menu "screen sessions" 0 0 0 "new screen" $ss "just bash" 2>&1 1>&3);xs=$?;exec 3>&-;if [ $xs -eq 0 ];then if [[ "$s" == "just bash" ]];then screen -X screen ssh -t $r bash;elif [[ "$s" == "new screen" ]];then screen -X screen -t $r ssh -t $r screen -m;else screen -X screen -t $r ssh -t $r screen -dRR $(echo $s|sed -nr "s/^([0-9]+)\..+/\1/p");fi;fi;fi;elif [ $xh -eq 1 ];then break;elif [ $xh -eq 3 ];then screen -X title ssh-manager;continue;fi;done;reset;clear;'
##############################################################################
###### ADDITIONAL STUFF (put it where specified; remember to uncomment) ######
##############################################################################
### this goes in your .bashrc, for colorful prompts & window autorenaming magic
#prompt(){
# PS1="\u@\h:\w\$>\[\e(B\e[m\]"
# PS2=">\[\e(B\e[m\]"
# case $1 in
# r) PS1="\[\e(B\e[m\e[91m\]$PS1";PS2="\[\e(B\e[m\e[91m\]$PS2" ;;
# o) PS1="\[\e(B\e[m\e[33m\]$PS1";PS2="\[\e(B\e[m\e[33m\]$PS2" ;;
# y) PS1="\[\e(B\e[m\e[93m\]$PS1";PS2="\[\e(B\e[m\e[93m\]$PS2" ;;
# g) PS1="\[\e(B\e[m\e[92m\]$PS1";PS2="\[\e(B\e[m\e[92m\]$PS2" ;;
# c) PS1="\[\e(B\e[m\e[96m\]$PS1";PS2="\[\e(B\e[m\e[96m\]$PS2" ;;
# b) PS1="\[\e(B\e[m\e[94m\]$PS1";PS2="\[\e(B\e[m\e[94m\]$PS2" ;;
# m) PS1="\[\e(B\e[m\e[95m\]$PS1";PS2="\[\e(B\e[m\e[95m\]$PS2" ;;
# w) PS1="\[\e(B\e[m\e[97m\]$PS1";PS2="\[\e(B\e[m\e[97m\]$PS2" ;;
# R) PS1="\[\e(B\e[m\e[41m\e[30m\]$PS1";PS2="\[\e(B\e[m\e[41m\e[30m\]$PS2" ;;
# O) PS1="\[\e(B\e[m\e[43m\e[30m\]$PS1";PS2="\[\e(B\e[m\e[43m\e[30m\]$PS2" ;;
# Y) PS1="\[\e(B\e[m\e[103m\e[30m\]$PS1";PS2="\[\e(B\e[m\e[103m\e[30m\]$PS2" ;;
# G) PS1="\[\e(B\e[m\e[102m\e[30m\]$PS1";PS2="\[\e(B\e[m\e[102m\e[30m\]$PS2" ;;
# C) PS1="\[\e(B\e[m\e[46m\e[30m\]$PS1";PS2="\[\e(B\e[m\e[46m\e[30m\]$PS2" ;;
# B) PS1="\[\e(B\e[m\e[104m\e[30m\]$PS1";PS2="\[\e(B\e[m\e[104m\e[30m\]$PS2" ;;
# M) PS1="\[\e(B\e[m\e[45m\e[30m\]$PS1";PS2="\[\e(B\e[m\e[45m\e[30m\]$PS2" ;;
# W) PS1="\[\e(B\e[m\e[107m\e[30m\]$PS1";PS2="\[\e(B\e[m\e[107m\e[30m\]$PS2" ;;
# esac
# case $TERM in
# screen*) PS1="\[\ek\e\\\\\]\[\ek\w\e\\\\\]$PS1" ;;
# esac
#}
##choose your prompt color here
#prompt b
#
##define functions for certain programs, in order to set the screen window title to program name + arguments, instead of just the program name
#case $TERM in
# screen*)
# sudo() { echo -ne "\eksudo $1\e\\"; /usr/bin/sudo $@; }
# vim() { echo -ne "\ekvim $@\e\\"; /usr/bin/vim $@; }
# man() { echo -ne "\ekman $@\e\\"; /usr/bin/man $@; }
# ;;
#esac
Zombie threat I know, but I'm a bit proud of this unholy mess:
Where... where. Shall we bring out the shotguns?
But really, that's a very complex .screenrc! And you are brave enough to use nested sessions too.
]]>###### screenrc
###### adopted from robzn, overhauled by then4116
###### This config is aimed at powerusers, who work on a lot of machines, and need a lot of information at a glance
###### It's intendet to facilitate usage of deeply nested screen sessions
###### as such, it relies heavily on keybindings to modify other keybindings, and multi-key bindings
### options
defscrollback 10000 # set scrollback buffer to 10000
defutf8 on on # set utf8
vbell off # disable visual bell
startup_message off # disable startup message 'new screen ..'
setenv DISPLAY ':0' # eg for mplayer
deflog on # enable logging
logfile /root/screen.%n # set log location
nethack off # nethack like notifications
defmonitor on # turn on monitoring (for activity)
activity "activity in %n" # enable activity
multiuser on # enable screen -x
shell bash # default shell
autodetach on # automatically detach upon hangup
altscreen on
msgwait 3
termcapinfo xterm|xterms|xs|rxvt ti@:te@ # use xterm's normal screen buffer (which includes scrollback). Makes scrolling back with mouse/touchpad in X11 useful.
defnonblock 1
### keybindings
bind 'w' sessionname
bind '\' quit #'
bind 'k' kill
bind 'F' flow
# by default, F11/F12 switch windows left/right.
bindkey -k F1 eval 'monitor off' 'prev' 'monitor on' # turning off monitoring for the duration of the switch, so that the bell sent by nested screen sessions when switching away from them is ignored. A nicer solution would be welcome!
bindkey -k F2 eval 'monitor off' 'next' 'monitor on'
# these bindings switch the keys for window navigation between F11/F12, F9/F10, F7/F8, F5/F6, F3/F4 & F1/F2 - useful for managing nested sessions
# usage: press ^A-u[123456]. The digit is the nesting depth.
bindkey -t "^Au1" eval 'bindkey -k k1' 'bindkey -k k2' 'bindkey -k k3' 'bindkey -k k4' 'bindkey -k k5' 'bindkey -k k6' 'bindkey -k k7' 'bindkey -k k8' 'bindkey -k k9' 'bindkey -k k;' 'bindkey -k F1 eval "monitor off" "prev" "monitor on"' 'bindkey -k F2 eval "monitor off" "next" "monitor on"'
bindkey -t "^Au2" eval 'bindkey -k k1' 'bindkey -k k2' 'bindkey -k k3' 'bindkey -k k4' 'bindkey -k k5' 'bindkey -k k6' 'bindkey -k k7' 'bindkey -k k8' 'bindkey -k F1' 'bindkey -k F2' 'bindkey -k k9 eval "monitor off" "prev" "monitor on"' 'bindkey -k k; eval "monitor off" "next" "monitor on"'
bindkey -t "^Au3" eval 'bindkey -k k1' 'bindkey -k k2' 'bindkey -k k3' 'bindkey -k k4' 'bindkey -k k5' 'bindkey -k k6' 'bindkey -k k9' 'bindkey -k k;' 'bindkey -k F1' 'bindkey -k F2' 'bindkey -k k7 eval "monitor off" "prev" "monitor on"' 'bindkey -k k8 eval "monitor off" "next" "monitor on"'
bindkey -t "^Au4" eval 'bindkey -k k1' 'bindkey -k k2' 'bindkey -k k3' 'bindkey -k k4' 'bindkey -k k7' 'bindkey -k k8' 'bindkey -k k9' 'bindkey -k k;' 'bindkey -k F1' 'bindkey -k F2' 'bindkey -k k5 eval "monitor off" "prev" "monitor on"' 'bindkey -k k6 eval "monitor off" "next" "monitor on"'
bindkey -t "^Au5" eval 'bindkey -k k1' 'bindkey -k k2' 'bindkey -k k5' 'bindkey -k k6' 'bindkey -k k7' 'bindkey -k k8' 'bindkey -k k9' 'bindkey -k k;' 'bindkey -k F1' 'bindkey -k F2' 'bindkey -k k3 eval "monitor off" "prev" "monitor on"' 'bindkey -k k4 eval "monitor off" "next" "monitor on"'
bindkey -t "^Au6" eval 'bindkey -k k3' 'bindkey -k k4' 'bindkey -k k5' 'bindkey -k k6' 'bindkey -k k7' 'bindkey -k k8' 'bindkey -k k9' 'bindkey -k k;' 'bindkey -k F1' 'bindkey -k F2' 'bindkey -k k1 eval "monitor off" "prev" "monitor on"' 'bindkey -k k2 eval "monitor off" "next" "monitor on"'
# since the F-keys are now used up, you can send them to the shell via keybindings. Just press ^A, and then type out f5, f12 or whatever. F1 must be sent as f01
bindkey -t "^Af01" stuff "^[OP~"
bindkey -t "^Af2" stuff "^[OQ~"
bindkey -t "^Af02" stuff "^[OQ~"
bindkey -t "^Af3" stuff "^[OR~"
bindkey -t "^Af03" stuff "^[OR~"
bindkey -t "^Af4" stuff "^[OS~"
bindkey -t "^Af04" stuff "^[OS~"
bindkey -t "^Af5" stuff "^[[15~"
bindkey -t "^Af05" stuff "^[[15~"
bindkey -t "^Af6" stuff "^[[17~"
bindkey -t "^Af06" stuff "^[[17~"
bindkey -t "^Af7" stuff "^[[18~"
bindkey -t "^Af07" stuff "^[[18~"
bindkey -t "^Af8" stuff "^[[19~"
bindkey -t "^Af08" stuff "^[[19~"
bindkey -t "^Af9" stuff "^[[20~"
bindkey -t "^Af09" stuff "^[[20~"
bindkey -t "^Af10" stuff "^[[21~"
bindkey -t "^Af11" stuff "^[[23~"
bindkey -t "^Af12" stuff "^[[24~"
### startup windows
# screen -t wicd 0 wicd-curses
# screen -t X 1
### backticks
# backtick id lifespan autorefresh cmd args...
backtick 1 10 10 /usr/bin/myip2
backtick 2 10 10 /usr/bin/memory
backtick 3 30 30 sh -c 'screen -ls | grep --color=no -o "$PPID[^[:space:]]*"' # session title
#backtick 4 60 60 /usr/bin/battery # laptops only!
### caption & hardstatus
# Caption & hardstatus lines can be switched off/on with ^A-e/E and ^A-y/Y, respectively.
caption always "%{= kw}|%{= kG} %3`: %{+r kg}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kg}%+w%{-r} %{kG}%=%D %Y-%m-%d | %c:%s %{= kw}|" #`"
bind 'E' caption always "%{= kw}|%{= kG} %3`: %{+r kg}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kg}%+w%{-r} %{kG}%=%D %Y-%m-%d | %c:%s %{= kw}|" #`"
bind 'e' caption splitonly ""
hardstatus off # emulation of the terminal’s hardstatus line
hardstatus lastline "%{= kw}|_%=%{kG}$USER@%H%{kw}|%{kG}%1`%{kw}|%{kG}L:%l%{kw}|%{kG}%2`%{kw}|%{kG}%4`%=%{kw}_|" #`"
bind 'Y' hardstatus lastline "%{= kw}|_%=%{kG}$USER@%H%{kw}|%{kG}%1`%{kw}|%{kG}L:%l%{kw}|%{kG}%2`%{kw}|%{kG}%4`%=%{kw}_|" #`"
bind 'y' hardstatus ignore
# Now this here is some crazy shit. In order to smoothly change colors, and still enable switching off/on of caption & hardstatus, we not only have to set the respective strings, but also the keybindings to switch them off/on. I tried to use variables for that, but it didn't quite work out.
# usage: press ^A-#[rgybmc] to change the color
bindkey -t "^A#r" eval 'caption string "%{= kw}|%{= kR} %3`: %{+r kr}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kr}%+w%{-r} %{kR}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'hardstatus string "%{= kw}|_%=%{kR}$USER@%H%{kw}|%{kR}%1`%{kw}|%{kR}L:%l%{kw}|%{kR}%2`%{kw}|%{kR}%4`%=%{kw}_|"' 'bind "E" caption always "%{= kw}|%{= kR} %3`: %{+r kr}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kr}%+w%{-r} %{kR}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'bind "Y" hardstatus lastline "%{= kw}|_%=%{kR}$USER@%H%{kw}|%{kR}%1`%{kw}|%{kR}L:%l%{kw}|%{kR}%2`%{kw}|%{kR}%4`%=%{kw}_|"'
bindkey -t "^A#g" eval 'caption string "%{= kw}|%{= kG} %3`: %{+r kg}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kg}%+w%{-r} %{kG}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'hardstatus string "%{= kw}|_%=%{kG}$USER@%H%{kw}|%{kG}%1`%{kw}|%{kG}L:%l%{kw}|%{kG}%2`%{kw}|%{kG}%4`%=%{kw}_|"' 'bind "E" caption always "%{= kw}|%{= kG} %3`: %{+r kg}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kg}%+w%{-r} %{kG}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'bind "Y" hardstatus lastline "%{= kw}|_%=%{kG}$USER@%H%{kw}|%{kG}%1`%{kw}|%{kG}L:%l%{kw}|%{kG}%2`%{kw}|%{kG}%4`%=%{kw}_|"'
bindkey -t "^A#y" eval 'caption string "%{= kw}|%{= kY} %3`: %{+r ky}%-w%{-r} %{+r kw}%n %t%{-r} %{+r ky}%+w%{-r} %{kY}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'hardstatus string "%{= kw}|_%=%{kY}$USER@%H%{kw}|%{kY}%1`%{kw}|%{kY}L:%l%{kw}|%{kY}%2`%{kw}|%{kY}%4`%=%{kw}_|"' 'bind "E" caption always "%{= kw}|%{= kY} %3`: %{+r ky}%-w%{-r} %{+r kw}%n %t%{-r} %{+r ky}%+w%{-r} %{kY}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'bind "Y" hardstatus lastline "%{= kw}|_%=%{kY}$USER@%H%{kw}|%{kY}%1`%{kw}|%{kY}L:%l%{kw}|%{kY}%2`%{kw}|%{kY}%4`%=%{kw}_|"'
bindkey -t "^A#b" eval 'caption string "%{= kw}|%{= kB} %3`: %{+r kb}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kb}%+w%{-r} %{kB}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'hardstatus string "%{= kw}|_%=%{kB}$USER@%H%{kw}|%{kB}%1`%{kw}|%{kB}L:%l%{kw}|%{kB}%2`%{kw}|%{kB}%4`%=%{kw}_|"' 'bind "E" caption always "%{= kw}|%{= kB} %3`: %{+r kb}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kb}%+w%{-r} %{kB}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'bind "Y" hardstatus lastline "%{= kw}|_%=%{kB}$USER@%H%{kw}|%{kB}%1`%{kw}|%{kB}L:%l%{kw}|%{kB}%2`%{kw}|%{kB}%4`%=%{kw}_|"'
bindkey -t "^A#m" eval 'caption string "%{= kw}|%{= kM} %3`: %{+r km}%-w%{-r} %{+r kw}%n %t%{-r} %{+r km}%+w%{-r} %{kM}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'hardstatus string "%{= kw}|_%=%{kM}$USER@%H%{kw}|%{kM}%1`%{kw}|%{kM}L:%l%{kw}|%{kM}%2`%{kw}|%{kM}%4`%=%{kw}_|"' 'bind "E" caption always "%{= kw}|%{= kM} %3`: %{+r km}%-w%{-r} %{+r kw}%n %t%{-r} %{+r km}%+w%{-r} %{kM}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'bind "Y" hardstatus lastline "%{= kw}|_%=%{kM}$USER@%H%{kw}|%{kM}%1`%{kw}|%{kM}L:%l%{kw}|%{kM}%2`%{kw}|%{kM}%4`%=%{kw}_|"'
bindkey -t "^A#c" eval 'caption string "%{= kw}|%{= kC} %3`: %{+r kc}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kc}%+w%{-r} %{kC}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'hardstatus string "%{= kw}|_%=%{kC}$USER@%H%{kw}|%{kC}%1`%{kw}|%{kC}L:%l%{kw}|%{kC}%2`%{kw}|%{kC}%4`%=%{kw}_|"' 'bind "E" caption always "%{= kw}|%{= kC} %3`: %{+r kc}%-w%{-r} %{+r kw}%n %t%{-r} %{+r kc}%+w%{-r} %{kC}%=%D %Y-%m-%d | %c:%s %{= kw}|"' 'bind "Y" hardstatus lastline "%{= kw}|_%=%{kC}$USER@%H%{kw}|%{kC}%1`%{kw}|%{kC}L:%l%{kw}|%{kC}%2`%{kw}|%{kC}%4`%=%{kw}_|"'
sorendition +b Wk # coloring cmds & messages
shelltitle '>|bash' # necessary for window autorenaming magic. Set the first character to whatever your bash prompt ends in.
###### additional stuff
### this goes in your bashrc, also for window autorenaming magic
#case $TERM in
# screen*)
# # This is the escape sequence ESC k \w ESC \
# #Use path as titel
# SCREENTITLE='\[\ek\w\e\\\]'
# #Use program name as titel
# SCREENTITLEPROGRAM='\[\ek\e\\\]'
# # only one of them will be filled correctly
# ;;
# *)
# SCREENTITLE=''
# SCREENTITLEPROGRAM=''
# ;;
#esac
#PS1="${SCREENTITLEPROGRAM}${SCREENTITLE}${PS1}"
### /usr/bin/myip2
# ip -o addr list|sed -rn '1h;1!H;${;g;s/^/\n/g;s/\n[0-9]+:\s+/\n/g;s/\n(:?[^ ]+:|lo)[^\n]+//g;s/\n([^ ]+)([^\n]+)(\1:[0-9]+)/\n\3\2/g;s/\n[^\n]+scope link[^\n]+//g;s/\n([^ ]+)\s+inet6? ([^ ]+)[^\n]+/\n\1=\2/g;s/^\n//g;s/[\n ]+/ /g;p;}'
### /usr/bin/memory (really should think of a better name for this)
# awk '/^MemTotal:/{MemTotal=$2};/^MemFree:/{MemFree=$2};/^Buffers:/{Buffers=$2};/^Cached:/{Cached=$2};/^SwapTotal:/{SwapTotal=$2};/^SwapFree:/{SwapFree=$2;print"M:"int((MemTotal-MemFree-Buffers-Cached)/1024)"/"int(MemTotal/1024)",S:"int((SwapTotal-SwapFree)/1024)"/"int(SwapTotal/1024)}' /proc/meminfo
### /usr/bin/battery (needs a better name as well. I think there was a reason to put it in a script instead of just calling it directly in screenrc, but I can't remember what it was)
# acpi|cut -d" " -f4,5
here's the .screenrc
# Fix for residual text
altscreen on
# custom statusbar
hardstatus off
hardstatus alwayslastline
hardstatus string '%{= kW}[ %{m}%H %{W}][%= %{= kw}%?%-Lw%?%{r}(%{g}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{W}][%{Y} %d/%m %{Y}%c %{W}]'
# Turn welcome message off
startup_message off
# disable vbell (so wm urgency hints can work from within screen)
vbell off
# Increase the scrollback buffer
defscrollback 5000
# programs to autostart on screen startup
screen -t htop 0 htop
screen -t root 1 su -
screen -t bash 2
screen -t bash 3
screen -t iftop 5
stuff "sudo iftop\012"
screen -t rtorrent 6
screen -t mutt 7
stuff "mutt\012"
screen -t log 9
stuff "tail --follow=name --retry --lines=1000 /var/log/everything.log\012"
#screen -t im 10
screen -t mc 8
stuff "mc /home/x33a /home/x33a/downloads\012"
select 1
# for mutt transparency
defbce on
# set terminal name
term rxvt-256color
# message display time (seconds)
msgwait 2
# 256 colour support for urxvt
terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# access terminals higher than 0-9 range
#
# add the following commands to command-class selectHighs
bind -c selectHighs 0 select 10 # C-a - 0 will open terminal 10
bind - command -c selectHighs # bind hyphen to command-class selectHighs
EDIT: Minor additions and tweaks to .screenrc
]]>hardstatus alwayslastline '%{= dd}%{= Wr} %D %d %M %c > %{= Ww}%-w%{= Wk}%n %t%{= Ww}%+w %{= dd} %='
What's the name of your browser? It looks good, I want to try it.
]]>Backtick is a python script that can be found here: https://bbs.archlinux.org/viewtopic.php … 74#p930174
activity ''
altscreen on
attrcolor b ".I" # allow bold colors - necessary for some reason
backtick 1 0 0 /usr/bin/ifpy -S -i 2 eth0
defbce on # use current bg color for erased chars
defscrollback 5000
hardstatus off
hardstatus alwayslastline '%{= kw}%-w%{= m}%n %t%{-}%+w %-= %1` %{B}%d %D %{c}%c'
sorendition +b k
startup_message off
term xterm-256color
termcapinfo xterm* ti@:te@i # X scrolling mechanism
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # tell screen how to set colors. AB = background, AF=foreground
vbell off
bind c screen 1
bind ^c screen 1
bind 0 select 10
# F1 keybinds:
bindkey -k k1 select 1
bindkey -k k2 select 2
bindkey -k k3 select 3
bindkey -k k4 select 4
bindkey -k k5 select 5
bindkey -k k6 select 6
bindkey -k k7 select 7
bindkey -k k8 select 8
bindkey -k k9 select 9
screen -t rTorrent 2
screen -t bash 3
screen -t bash 4
screen -t irssi 1
here' my .screenrc
#Fix for residual editor text
#When you open a text editor like nano in screen and then close it, the text may stay visible in your terminal. To fix this, #put the following in your ~/.screenrc:
altscreen on
# Informative statusbar
hardstatus off
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
# Turn welcome message off
startup_message off
# Increase the scrollback buffer
defscrollback 5000
# open these programs automatically on screen startup
screen -t bash 1
screen -t bash 2
screen -t root 7 su -
screen -t mc 8 mc /home/x33a /home/x33a/Desktop
screen -t log 9 tail --follow=name --retry --lines=1000 /var/log/everything.log
screen -t htop 0 htop
hardstatus alwayslastline "%?%{gk}%-Lw%?%{mk}%n*%f %t%?(%u)%?%?%{gk}%+Lw%?%{Yk} | %{yk}RPD: %{Bk}%1`"
hardstatus alwayslastline '%{= M} %H%{= B} %l %= %{= w}%-w%{+b r}%n*%t%{-b r}%{w}%+w %= %{c}%d %D %{B}%c '
hardstatus alwayslastline "%?%{rk}%-Lw%?%{Ck}%n*%f %t%?(%u)%?%?%{rk}%+Lw%?%{Yk} | %{mk}%1` %{yk}%=%2`"
term putty-256color
debug off
chdir $HOME
maxwin 11
verbose on
autodetach on
nethack on # print wackier status messages
password HJa4lhjDp4UIDlLA # always of course
defobuflimit 4096
setenv LC_CTYPE en_US.UTF-8
defutf8 on
defencoding UTF-8
idle 360 eval "screen nice -n 19 /opt/s/cmatrix" "idle 360000 pow_detach"
shell -$SHELL # use the default shell
shelltitle '$ | bash' # search | name for dynamic window titles
defmode 600
defmonitor off # turn monitoring on
defnonblock 2 # flaky/slow ssh lines
defscrollback 15000 # 5000 line scrollback
deflog off
defbce on # erase background with current bg color
defflow off # will force screen to process ^S/^Q
deflogin on # Log new screen windows in utmp.
hardcopy_append on
hardcopydir ~/.backups/.screen
bufferfile ~/.backups/.screen/buffer
logfile ~/.backups/.screen/screen_%y-%m-%d_%n
zombie cr # don't kill window after the process died
silencewait 4
startup_message off # no way
autodetach on # Never, ever turn this off.
zombie cr # Keep dead windows around until I tell them to exit.
verbose on # And show the command for the windows when they're resurrected.
altscreen on # restore window contents after using (e.g.) vi
attrcolor b ".I" # allow bold colors - necessary for some reason
msgwait 6 # 6 second messages
msgminwait 2
multiuser off
pow_detach_msg "Screen session of $LOGNAME $:cr:$:nl:ended." # emulate .logout message
# debug - debugging info is written to /tmp/debug/
# dumptermcap - Termcap entry written to "/home/srot/tmp/.screen/.termcap".
# info - (1,3)/(270,37)+5000 -(-)flow bce UTF-8 6(hellopwd)
# dinfo - (270,77) UTF-8 color iso2022
# ===============================================================
# Messages
# ===============================================================
# They are also the names of the commands that set the respective messages. In every message there can be "meta
# strings" which are replaced by values. A meta string starts with a percent sign and is then followed by one
# of the following letters: aAcCdDfFhHlmMnstuwWyY The meta strings usually refer to the current
# date and time or to a window title or number. There are also some specials like embedded branches (with %?),
# color codes (with %{xy}) and padding (with %=, %<, %>). you can find their description in the manual in section "STRING ESCAPES":
#
# %% percent sign (the escape character itself)
# %f flags of the window
# %F sets %? to true if the window has the focus
# %h hardstatus of the window
# %H hostname of the system
# %l current load of the system
# %n window number
# %t window title
# %u all other users on this window
# %w all window numbers and names.
# %-w all window numbers up to the current window
# %+w all window numbers after the current window
# %W all window numbers and names except the current one
#
# DATE VARS -- USELESS!
# %a either 'am' or 'pm' - according to the current time
# %A either 'AM' or 'PM' - according to the current time
# %c current time HH:MM in 24h format
# %C current time HH:MM in 12h format
# %d day number - number of current day
# %D Day's name - the weekday name of the current day
# %m month number
# %M month name
# %s seconds
# %y last two digits of the year number
# %Y full year number
# ===============================================================
vbell off # I like to hear the beep.
activity "%c activity -> %n%f %t^G" # ^G makes it beep
bell "%c bell -> %n%f %t^G" # likewise
###########################################################################################################################
#
# TERMINAL CONTROL
# ae: Standout # ct: Initialization # es: Status Line
# AL: Insdel Line # cv: Cursor Motion # ff: Cursor Motion
# al: Insdel Line # da: Scrolling # fs: Status Line
# am: Wrapping # dB: Pad Specs # gn: Basic
# as: Standout # db: Scrolling # hc: Basic
# bc: Cursor Motion # dC: Pad Specs # hd: Half-Line
# bl: Bell # DC: Insdel Char # ho: Cursor Motion
# bs: Cursor Motion # dc: Insdel Char # hs: Status Line
# bt: Cursor Motion # dF: Pad Specs # hu: Half-Line
# bw: Cursor Motion # DL: Insdel Line # hz: Basic
# CC: Basic # dl: Insdel Line # i1: Initialization
# cd: Clearing # dm: Insdel Char # i3: Initialization
# ce: Clearing # dN: Pad Specs # IC: Insdel Char
# ch: Cursor Motion # DO: Cursor Motion # ic: Insdel Char
# cl: Clearing # do: Cursor Motion # if: Initialization
# CM: Cursor Motion # ds: Status Line # im: Insdel Char
# cm: Cursor Motion # dT: Pad Specs # in: Insdel Char
# co: Screen Size # ec: Clearing # ip: Insdel Char
# cr: Cursor Motion # ed: Insdel Char # is: Initialization
# cS: Scrolling # ei: Insdel Char # it: Initialization
# cs: Scrolling # eo: Basic
#
termcapinfo * hs@
###########################################################################################################################
# COLOR: colors codes are combinations of [attribute modifier] [color description]
# the manual talks of "attribute/color modifiers".
#
# 0 Black . leave color unchanged
# 1 Red b blue
# 2 Green c cyan
# 3 Brown / yellow d default color
# 4 Blue g green b bold
# 5 Purple k blacK B blinking
# 6 Cyan m magenta d dim
# 7 White r red r reverse
# 8 unused/illegal w white s standout
# 9 transparent y yellow u underline
#
# note: "dim" is not mentioned in the manual.
#hardstatus string "%-Lw%{= G0}%50>%n%f* %t%{-}%+Lw%<"
#hardstatus string "%?%F%{-b bc}%:%{-b bb}%?%C|%D|%M %d|%H|%0`%?%F%{+u wb}%? %L=%-Lw%45>%{+b by}%n%f* %t%{-}%+Lw%-0<"
#yaption always "%?%F%{.R.}%?%3n %t%? [%h]%?"
#caption always "%?%F%{-b bc}%:%{-b bb}%?%C|%D|%M %d|%H|%1`%?%F%{+u wb}%? %L=%-Lw%45>%{+b by}%n%f* %t%{-}%+Lw%-0<"
#hardstatus alwayslastline
#hardstatus string "%?%F%{-b bc}%:%{-b bb}%?%C|%D|%M %d|%H|%1`%?%F%{+u wb}%? %L=%-Lw%45>%{+b kG}%n%f* %t%{-}%+Lw%-0<"
hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w"
# Make screen messages stand out a little more - black on bright green.
#sorendition "= kG"
#caption always "%{.wB}%-w%{.bW}%n %t%{-}%+w %=%{..Lw} %H %{..b} %m/%d %C%a "
caption always "%{cK}$LOGNAME %{bK}(%d %M %Y, %c) %{-}%{bW} %-w%{bW}%50>%{= wb}%n%f %t%{-}%+w%< %{-}"
###########################################################################################################################
#
# default windows
# L - LOGGING
# l - log to utmp
# ln - nolog to utmp
# O - better vt100 emul
# a - all terminal caps
# A - resize
# h - scrol lines
#
screen -t 'LOG' -h 0 1 nice -n 19 sh -c 'read -n1 -t1000000 -p "[ LOG ]" && exec sudo nice tail -n 60 -s 10 -f /var/log/everything.log | ccze -A'
screen -t 'MEM' -h 0 2 nice -n 19 sh -c 'read -n1 -t1000000 -p "[ MEM ]" && sleep 4 && tput civis; CLS=$`tput clear`; trap "tput cnorm; exit 0" 1 2 3; while :; do free -olt && sleep 2 && echo $CLS; done;'
screen -t 'NET' -h 0 3 nice -n 19 sh -c 'read -n1 -t1000000 -p "[ NET ]" && while :; do /bin/netstat --numeric-ports -a -e --tcp |sort --key=4 && sleep 5; done;'
screen -t 'WWW' lynx http://www.askapache.com/
screen -t '# |ROOT' 4 sh -c 'read -n1 -t1000000 -p "[ ROOT ]" && exec sudo su -'
screen -t 'askapache' 5 sh -c 'read -n1 -t1000000 -p "[ ASKAPACHE ]" && exec sudo su - askapache'
screen -t 'compiler' 6 sh -c 'read -n1 -t1000000 -p "[ srot ]" && exec sudo su - compiler'
#select 5
windowlist
# screen -t 'BASH4' 5 sh -c 'read -n1 -p "[ BASH4 ] && export SHELL=/bin/bash4 && /bin/bash4 -l'
# screen -h 5000 -t 'bash' 1
# screen -h 5000 -t 'root' 2
# sudo -i screen -h 5000 -t 'gator' 3
# $HOME/.ssh/start_control.sh select
# screen -h 100 -t 'log' 4 sudo sh -c 'nice tail -n 60 -s 10 -f /var/log/everything.log | ccze -A'
# screen -h 100 -t 'top' 5 nice top -c
# screen -h 100 -t 'netstat' 6 nice sh -c 'watch -n 30 -t netstat -ane'
# links http://www.askapache.com/
###########################################################################################################################
#
# CUSTOM keybindings
#
# bind ^t screen -t 'TOP' sh -c 'exec sudo nice /usr/bin/top'
# bind ^g screen -t 'LOG' sh -c 'exec sudo nice tail -s 3 -n 25 -f /usr/local/apache/logs/error_log /home/askapache/sites/askapache.com/logs/php_error.log|ccze -A'
# bind ^g screen -t 'gator' -$SHELL $HOME/.ssh/start_control.sh
# bind ^s screen -t 'root' sudo -i
###########################################################################################################################
# bindkey [@var{opts}] [@var{string} [@var{cmd} @var{args}]]
#
# keybindings
#
# remove some stupid / dangerous key bindings
bind k
bind ^k
bind ^.
bind .
bind ^\
bind \\
bind ^h
bind h
bind ^x
bind x
bind }
bind ^}
# Window numbering starts at 1, not 0
bind c screen 1
bind 0 select 10
bind = resize =
bind + resize +1
bind - resize -1
bind _ resize max
bind 'K' kill
bind 'X' lockscreen
bind 'I' login on
bind 'O' login off
bind '}' history
# Prepend/append register [/] to the paste if ^a^] is pressed. autoindent mode in vi.
register [ "\033:se noai\015a"
register ] "\033:se ai\015a"
bind ^] paste [.]
# A better detach
bind ^D eval 'echo -p "\^\^D%080="' 'command -c detach'
bind -c detach d detach
bind -c detach ^D detach
bind -c detach D pow_detach
# This one is great, restarts/reloads screen
bind . eval 'source /etc/screenrc' 'echo "/etc/screenrc has been reloaded."'
###
# Use the function keys to switch among windows.
##
bindkey -k k1 select 1
bindkey -k k2 select 2
bindkey -k k3 select 3
bindkey -k k4 select 4
bindkey -k k5 select 5
bindkey -k k6 select 6
bindkey -k k7 select 7
bindkey -k k8 select 8
bindkey -k k9 select 9
bindkey -k k; select 10
bindkey -k F1 select 11
bindkey -k F2 select 12
# windows 13-24 are Shift-Fn
#bindkey -k F3 select 13
#bindkey -k F4 select 14
#bindkey -k F5 select 15
#bindkey -k F6 select 16
#bindkey -k F7 select 17
#bindkey -k F8 select 18
#bindkey -k F9 select 19
#bindkey -k FA select 20
# vim: tw=78 ts=3 sw=3 et nowrap ft=screen paste nonumber nofoldenable
Here is my custom-built (for 256-colors + screen), I'd rather edit this and keep it backed up than fiddle with screen's termcapinfo stuff.
# Reconstructed via infocmp from file: /usr/share/terminfo/p/putty-256color
putty-256color|PuTTY 0.58 with xterm 256-colors,
am, bce, bw, ccc, hs, mir, msgr, xenl, xon,
colors#256, it#8, ncv#22, pairs#32767,
acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
clear=\E[H\E[J, cnorm=\E[?25h, cr=^M,
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M,
dsl=\E]0;\007, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
enacs=\E(B\E)0, flash=\E[?5h\E[?5l, fsl=^G, home=\E[H,
hpa=\E[%i%p1%dG, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L,
ind=^J, indn=\E[%p1%dS, initc@,
is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R,
kb2=\E[G, kbs=\177, kcan=^C, kcbt=\E[Z, kcub1=\E[D,
kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~,
kend=\E[4~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~,
kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~,
kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~,
kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~,
kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
kspd=^Z, nel=^M^J, oc=\E]R, op=\E[39;49m, rc=\E8, rev=\E[7m,
ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l,
rmcup=\E[2J\E[?47l, rmir=\E[4l, rmpch=\E[10m,
rmso=\E[27m, rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h,
s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, sc=\E7,
setab=\E[48;5;%p1%dm, setaf=\E[38;5;%p1%dm, sgr0=\E[0m,
smacs=^N, smam=\E[?7h, smcup=\E[?47h, smir=\E[4h,
smpch=\E[11m, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E]0;,
u6=\E[%i%p1%d;%p2%dR, u7=\E[6n, u8=\E[?6c, u9=\E[c,
vpa=\E[%i%p1%dd,
setenv LC_CTYPE en_US.UTF-8
defutf8 on
hardcopy_append on
crlf off
multiuser off
#deflogin on
bufferfile $HOME/.screen_buffer
pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." # Emulate a logout msg
msgwait 2 # 1 second messages
#silencewait 5
sorendition =s Gk
vbell off
vbell_msg " *beep* "
#activity "%c activity -> %n%f %t"
#bell "%c bell -> %n%f %t^G"
nethack on # print wackier status messages
nonblock on # If a window goes unresponsive, don't block the whole session waiting for it.
defnonblock 5 # flaky/slow ssh lines
altscreen on # restore window contents after using (e.g.) vi
defmonitor on # turn monitoring on
shell -$SHELL # use the default shell
defbce on # erase background with current bg color
defflow off # disable Ctrl-S/Ctrl-Q "flow control"
#logfile ~/screen_%y-%m-%d_%0c
# terminfo and termcap for nice 256 color terminal
termcapinfo xterm*|rxvt-* 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
termcapinfo xterm*|rxvt-* 'hs:ts=\E]0;:fs=\007:ds=\E]0;\007'
termcapinfo xterm*|rxvt-* ti@:te=\E[3J
termcapinfo xterm*|rxvt-* hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
termcapinfo xterm*|rxvt-* hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
attrcolor b ".I" # allow bold colors - necessary for some reason
term 'xterm-256color' # 256 terminal for xterm
#term screen-256color #By default, screen uses an 8-color terminal emulator. Use the following line to enable more colors, more-capable terminal emulator:
#
# hardstatus
#
hardstatus on
hardstatus alwayslastline
defhstatus "%{= 9}%-w%{= 9}%50>%n* %{= 9}%t%{= 9}%+w%< %= %{= R} %{= 9}%c:%s" # nice and simple
#hardstatus alwayslastline "%{=b}%{G} Screen(s): %{b}%w %=%{kG}%C%A %D, %M/%d/%Y "
#hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
#hardstatus alwayslastline "%{yk}( %{Y}%H %{y})%= %{wk}%?%-Lw%?%{R}(%{W}%n*%f %t%?(%u)%?%{R})%{w}%?%+Lw%?%?%= %{y}( %{Y}load: %l %{y})"
##hardstatus alwayslastline "%{=b kW}[ %{= Y}$USER @ %H %{b W}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{b W}][%{= Y} %l %{b W}][%{= Y} %d/%m %{Y}%c %{b W}]"
##hardstatus alwayslastline "%{=b kW}[ %{= Y}$USER @ %H %{b W}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{b W}][%{= Y} %m/%d/%y %{Y}%C %{b W}]"
##hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
##hardstatus alwayslastline "%{= kG}[ $USER@%{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d.%m.%Y %{W}%c:%s %{g}]"
hardstatus string "%{.wB}%-w%{.bW}%n %t%{-}%+w %=%{..Lw} %H %{..b} %m/%d %C%a "
screen -t bash 0
screen -t bash 1
select 0
#bind T screen -t 'pstree' 2 sudo watch -n 2 -t pstree -p -u -c -l -a -A|sed -e 's/\\040//g'
#bind L screen -t 'log' 3 sudo tail -s3 -n 10 -f /var/log/everything.log
#caption always "%{yK} $LOGNAME@%H | %l | %C %A - %M-%d-%Y | %-Lw%50>%{Ky}%n%f* %t%{-}%+Lw%<%{- Wk}%{yK} | "
#caption always "%{= wk} %?%-Lw%?%{= kd} %n*%f %t %{= wk}%?%+Lw%? %{= wk}%=%{= Wk} %C%a %m-%d-%Y %{= wk} "
#caption always "%{=b kW}[%= %{= K}F8=List F9=new F10=title F11=prev F12=next %{=b kW}%=]" #stolen and changed from cornfelt
#caption always " %m%d %c | %w"
#caption always "%?%{ Wk}%-Lw%?%{Rk}%n*%f %t%?(%u)%?%?%{Wk}%+Lw%? %{Rk}%=%c %{rk}%d/%M/%Y"
#caption always "%{=b dw}:%{-b dw}:%{=b dk}[ %{-b dw}%{-b dg}$USER%{-b dw}@%{-b dg}%H %{=b dk}] [ %= %?%{-b dg}%-Lw%?%{+b dk}(%{+b dw}%n:%t%{+b dk})%?(%u)%?%{-b dw}%?%{-b dg}%+Lw%? %{=b dk}]%{-b dw}:%{+b dw}:"
#caption always "%{+b kG} %=%{-s} %{.K}%-w%{.B}%n %{.G}%t%{.K}%+w%{.G} %{+s} %="
# Finally! Shift-pg up or down to view scrollback buffer
#
bindkey "^[[5;2~" eval "copy" "stuff ^u"
bindkey -m "^[[5;2~" stuff ^u
bindkey -m "^[[6;2~" stuff ^d
]]>term screen-256color
terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
setenv LC_CTYPE pl_PL.UTF-8
defutf8 on
startup_message off
activity "%c activity -> %n%f %t"
autodetach on
altscreen on
bell "%c bell -> %n%f %t^G"
defflow auto
defscrollback 10000
# F8 to turn the status bar off
bindkey -k k8 hardstatus alwayslastline
# F9 to turn the status bar on
bindkey -k k9 hardstatus alwaysignore
# F1 and F2 to move one screen forward or backward
bindkey -k k1 prev
bindkey -k k2 next
vbell_msg "[[[ ding ]]]"
vbell off
nethack on
backtick 1 60 60 /home/dziq/bin/screen_agenda
#hardstatus alwayslastline "%{.kK}[%1`@%H]"
hardstatus alwayslastline '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %m/%d %c ]%{W} [%1`]'
#hardstatus alwayslastline
#hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %Y-%m-%d %{W}%c %{g}]'
screen -t zsh 1 zsh
#screen -t rtorrent 1 rtorrent
#screen -t ekg2 1 ekg2
#screen -t mail 1 mutt
#screen -t imap 2 offlineimap
#screen -t music 4 ncmpcpp
I disagree :-| I like seeing how anyone sets up their screenrc. I find it's a fun way to learn.
do a `man screen`, way more educational
]]>