You are not logged in.

#76 2011-07-18 17:37:05

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: Post your .screenrc with screenshots!

That would be an old version of uzbl tabbed, with my custom CSS but I don't use that crap for some time now (you can still find the CSS on the uzbl wiki I believe). It doesn't look good, I *made* it look good tongue. Chrome + Surf is all I require lately. You could get surf + tabbed (both suckless products) to look similar to that too, if pretty and simplistic is what you're after (I was at the time).

Last edited by Lich (2011-07-18 17:41:03)


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#77 2011-07-20 07:26:18

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Post your .screenrc with screenshots!

screen-vs in multidisplay mode (-x switch is way too cool).

http://ompldr.org/vOWp0dA

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

Last edited by x33a (2011-12-07 15:04:53)

Offline

#78 2015-12-11 12:12:02

then4116
Member
Registered: 2012-09-24
Posts: 4

Re: Post your .screenrc with screenshots!

Zombie threat, I know, but I'm a bit proud of this unholy mess:

###### 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

Offline

#79 2015-12-13 17:23:04

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Post your .screenrc with screenshots!

then4116 wrote:

Zombie threat I know, but I'm a bit proud of this unholy mess:

Where... where. Shall we bring out the shotguns? tongue

But really, that's a very complex .screenrc! And you are brave enough to use nested sessions too.

Offline

#80 2016-01-15 18:22:23

then4116
Member
Registered: 2012-09-24
Posts: 4

Re: Post your .screenrc with screenshots!

x33a wrote:
then4116 wrote:

Zombie threat I know, but I'm a bit proud of this unholy mess:

Where... where. Shall we bring out the shotguns? tongue

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

Last edited by then4116 (2017-11-24 07:19:24)

Offline

#81 2018-01-17 20:00:00

oldgaro
Member
From: Brazil
Registered: 2017-09-19
Posts: 9
Website

Re: Post your .screenrc with screenshots!

So far a smooth transition from Tmux!

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

Last edited by oldgaro (2018-01-19 22:02:38)


GNU - Dwm - St - Screen - Zsh - SpacEmacs - Neovim
Github

Offline

Board footer

Powered by FluxBB