guest@dotshare [~/groups/terms/screen] $ ls neercs/ | cat

neercs (scrot) (+4 likes)

gutterslob Jun 27, 2011 (terms/screen)

.screenrc(raw, dl)

SCROT

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#Screen -RC (~/.screenrc)
########################################################################

# switch order of caption and hardstatus:
  hardstatus alwayslastline
  hardstatus string '%{= m}Load Avg:%{= G} %l %= %{= w}%-w%{+b r}%n:%t%{-b r}%{w}%+w %= %{b}%D %d/%m/%Y %{Y}%c'

# add CPU idle/sustem/user/interrupt stats
backtick 100 5 5 tail -1 /var/tmp/geezer_stats_top
caption always '%{= wk} %200` %= %100` %='


# detach on hangup
  autodetach            on            
  crlf                  off             
  deflogin              off             
# defsilence            off             
# hardcopy_append       on              
  hardcopy_append       off             
  nethack               on              
# don't display the copyright page
  startup_message       off             # default: on
# no annoying audible bell, please
  vbell                 on

  defscrollback         1000            # default: 100
# msgminwait            3               # default: 1
  silencewait           15              # default: 30

  hardcopydir           $HOME/.hardcopy

  shell                 /bin/zsh

# "sorendition": set the colors for
# the "messages" and "text marking"
# (ie text you mark in copy mode):
  sorendition 10 99 # default!

# use %n to display the window number and %t for its title:
  activity              "activity in %n (%t) [%w:%s]~"

# pass on the "beep" (CTRL-G) by adding a '~':
  bell                  "bell     in %n (%t) [%w:%s]~"

# pow_detach_msg:       Message shown when session
#                       gets power detached.
  pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."

# vbell_msg:            Message shown when the
#                       "virtual bell" rings.
  vbell_msg             " *beep* "

# Key bindings
# Remove some default key bindings by binding them to "nothing" (empty right-hand-side):
# bind .  dumptermcap # default
  bind .
  bind ^\
  bind \\

# 040126 To be able to select windows with n > 9 ->
# Press "C-a - #" instead of just "C-a #"
  bind - command -c select_1n
  bind -c select_1n 0 select 10
  bind -c select_1n 1 select 11
  bind -c select_1n 2 select 12
  bind -c select_1n 3 select 13
  bind -c select_1n 4 select 14
  bind -c select_1n 5 select 15
  bind -c select_1n 6 select 16
  bind -c select_1n 7 select 17
  bind -c select_1n 8 select 18
  bind -c select_1n 9 select 19
  bind -c select_1n - command -c select_2n
  bind -c select_2n 0 select 20
  bind -c select_2n 1 select 21
  bind -c select_2n 2 select 22
  bind -c select_2n 3 select 23
  bind -c select_2n 4 select 24
  bind -c select_2n 5 select 25
  bind -c select_2n 6 select 26
  bind -c select_2n 7 select 27
  bind -c select_2n 8 select 28
  bind -c select_2n 9 select 29
  bind -c select_2n - select -

# Cycle backwards/forwards in the list of existing windows:
  bindkey "^[Od" prev
  bindkey "^[Oc" next

# remove some stupid / dangerous key bindings
  bind k
  bind ^k
  bind .
  bind ^\
  bind \\
  bind ^h
  bind h  hardcopy
# make them better
  bind 'K' kill
  bind 'I' login on
  bind 'O' login off
  bind '}' history

  bind G screen -t 'google'    w3m www.google.com

# Paste - use 'P' instead of ']':
# bind P # unbound by default
  bind P paste .

# Yet another hack:
# Prepend/append register [/] to the paste if ^a^] is pressed.
# This lets me have autoindent mode in vi.
#  register [ "\033:se noai\015a"
#  register ] "\033:se ai\015a"
#  bind ^] paste [.]

#      X - a fast way to lock the current screen.
  bind X lockscreen

# 030511 Workaround for stupid machines without xmodmap ;-)
  bindkey -t °a stuff "ä"
  bindkey -t °A stuff "Ä"
  bindkey -t °o stuff "ö"
  bindkey -t °O stuff "Ö"
  bindkey -t °u stuff "ü"
  bindkey -t °U stuff "Ü"
  bindkey -t °s stuff "ß"

  msgwait 1
  version
# change back to showing messages
# for duration of two seconds:
  msgwait 2

# To get screen to add lines to xterm's scrollback buffer, uncomment the
# following termcapinfo line which tells xterm to use the normal screen buffer
# (which has scrollback), not the alternate screen buffer.
  termcapinfo xterm|xterms|xs|rxvt ti@:te@

# Welcome:
  echo "Point & Squirt"

CLICK TO VIEW

x

uniload.sh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh

STATS_FILE=/var/tmp/${USER}_stats_top
DELAY=1

# FreeBSD uses jot(1) while Linux uses seq(1)
which jot 1> /dev/null 2> /dev/null || alias jot=seq

__freebsd() {
  top -s ${DELAY} -d 2 0  \
    | grep -m 1 CPU \
    | sed 's/,//g' \
    | awk '{ print $4": "$3" | "$6": "$5" | "$8": "$7" | "$10": "$9" | "$12": "$11 }'
  }

__linux() {
  top -d ${DELAY} -n 2 -b \
    | grep -m 2 Cpu \
    | tail -1 \
    | sed 's/%/ /g' \
    | awk '{ print "User: " $2 " | System: " $4 " | Nice: " $6 " | Idle: " $8 }'
  }

__exit() {
  rm -rf ${STATS_FILE}
  exit 0
  }

trap '__exit' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
OS=$( uname )
while true
do
  for I in $( jot 128 ); do
    case ${OS} in
      (FreeBSD) __freebsd >> ${STATS_FILE} 2>&1 ;;
      (Linux)   __linux   >> ${STATS_FILE} 2>&1 ;;
      (*)       echo "supported systems: FreeBSD Linux"; exit 1 ;;
    esac
  done
  sleep 1
  :> ${STATS_FILE}
done
 

x

Notes

Pretty simple. The stats script I found at some BSD forum. Other bits are mostly the config that comes with GRML (my preferred distro when it comes to Debian-based) along with some little tweaks. I don’t realllly use screen all that much these days, tbh.

Edit:
Added uniload.sh script which gives the stats in the caption bar.

Comments

lchr said about 13 years ago

That color script is pretty fabulous. Can you gist or pastebin it for me? I’d appreciate that.

gutterslob said about 13 years ago
lchr said about 13 years ago

You rock, thanks.

Him said about 13 years ago

Nice, I’m going to have to steal this…