You are not logged in.
Any way to get mem usage and free disk space into a .screenrc? Would be an awesome addition for my file server.
Yes. Use the backtick command with a shell script that parses the output of free and df. See my screenrc in post #7 for the backtick command syntax.
Offline
Thanks, that'll get me something to do at work
Offline
You're welcome...
Offline
Playing with backtick's
backtick 1 60 60 $HOME/bin/get_uptime
backtick 2 60 60 $HOME/bin/get_cputemp Core0
backtick 3 60 60 $HOME/bin/get_freemem
backtick 4 60 60 $HOME/bin/get_freeswap
backtick 5 60 60 $HOME/bin/get_volume PCM
backtick 6 60 60 $HOME/bin/get_gmail
backtick 7 60 60 $HOME/bin/get_updates
hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w %= | %1` | %2`C | %3`/%4` | %5`% | %6`/%7` | %c %d/%m/%Y"
get_cputemp:
#!/bin/bash
sensors | grep $1 | awk '{print $3}' | tr -d +
get_freemem:
#!/bin/bash
free -m | grep - | awk '{print $4}'
get_freeswap:
#!/bin/bash
free -m | grep Swap | awk '{print $4}'
get_volume:
#!/bin/bash
status=$(amixer sget $1 | tail -n 1)
vol=$(echo ${status} | gawk '{print $5}' | tr -d [%])
state=$(echo ${status} | gawk '{print $7}')
text="${vol}"
echo ${text}
get_gmail:
#!/bin/bash
gmail_login="xxxxxxxx"
gmail_password="xxxxxxxxxxx"
dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)"
if [ -z "$dane" ]; then
echo "!"
else
echo "$dane"
fi
get_updates:
#! /usr/bin/perl -w
use strict;
# November 15, 2006
# Daniel Vredenburg (Vredfreak)
# This is a program that checks for package updates for Arch Linux users.
open (MYINPUTFILE, "/home/aleyscha/bin/arch-updates/updates.log") or die "No such file or directory: $!";
my $i = 0;
while(<MYINPUTFILE>)
{
if (/^(.*)\/(.*)(\..*\..*\.)/) {
#print " \n";
$i++;
}
}
if ($i == 0) {
print "0";
} else {
print "$i";
}
close(MYINPUTFILE);
Last edited by leo2501 (2008-10-25 10:56:13)
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery
Offline
...
Nice! i do hope that's not your real gmail account-info though...
Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!
Offline
Playing with backtick's
backtick 1 60 60 $HOME/bin/get_uptime backtick 2 60 60 $HOME/bin/get_cputemp Core0 backtick 3 60 60 $HOME/bin/get_freemem backtick 4 60 60 $HOME/bin/get_freeswap backtick 5 60 60 $HOME/bin/get_volume PCM backtick 6 60 60 $HOME/bin/get_gmail backtick 7 60 60 $HOME/bin/get_updates hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w %= | %1` | %2`C | %3`/%4` | %5`% | %6`/%7` | %c %d/%m/%Y"
get_cputemp:
#!/bin/bash sensors | grep $1 | awk '{print $3}' | tr -d +
get_freemem:
#!/bin/bash free -m | grep - | awk '{print $4}'
get_freeswap:
#!/bin/bash free -m | grep Swap | awk '{print $4}'
get_volume:
#!/bin/bash status=$(amixer sget $1 | tail -n 1) vol=$(echo ${status} | gawk '{print $5}' | tr -d [%]) state=$(echo ${status} | gawk '{print $7}') text="${vol}" echo ${text}
get_gmail:
#!/bin/bash gmail_login="xxxxxxxx" gmail_password="xxxxxxxxxxx" dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \ https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \ --no-check-certificate | grep 'fullcount' \ | sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)" if [ -z "$dane" ]; then echo "!" else echo "$dane" fi
get_updates:
#! /usr/bin/perl -w use strict; # November 15, 2006 # Daniel Vredenburg (Vredfreak) # This is a program that checks for package updates for Arch Linux users. open (MYINPUTFILE, "/home/aleyscha/bin/arch-updates/updates.log") or die "No such file or directory: $!"; my $i = 0; while(<MYINPUTFILE>) { if (/^(.*)\/(.*)(\..*\..*\.)/) { #print " \n"; $i++; } } if ($i == 0) { print "0"; } else { print "$i"; } close(MYINPUTFILE);
Sweet!
Offline
Awesome! I've never used backtick for anything other than parsing acpi's output. This thread really shows how flexible screen is. I totally agree with the author of this article that screen should win the "Most Undercelebrated Unix Tool" award.
Offline
Leo, thanks a lot for the bindkeys.
i recently noticed those keybindings don't work in the tty, but dont know why yet
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery
Offline
@rine: Can I get your terminal colors?
I will post my screenrc in a day or so; I'm still working out the kinks. Great ideas here, though.
Offline
dmz wrote:Leo, thanks a lot for the bindkeys.
i recently noticed those keybindings don't work in the tty, but dont know why yet
Yeah I've also noticed that. If you find some way the get them working in tty's also, please notify me.
Offline
Copied from various sources and adjusted.
# basic settings... self explainatory
deflogin on
autodetach on
startup_message off
# the dash makes it a login shell
defshell bash
activity ""
bell_msg ""
vbell off
vbell_msg ""
defscrollback 2048
nonblock on
defutf8 on
defbce on
defflow off
msgwait 1
altscreen on
# only Shift+k to kill - prevent accidents
bind k
bind ^k
bind K kill
escape \\\
term screen-256color
terminfo rxvt-unicode ti@:te@:
hardstatus alwayslastline "%{=}%-w%{+b w}%n %t%{-b w}%+w %=%c"
#let pgup/pgdn scroll under urxvt (see .Xdefaults)
bindkey "^[[5;2~" eval "copy" "stuff ^u"
bindkey -m "^[[5;2~" stuff ^u
bindkey -m "^[[6;2~" stuff ^d
select 1
Offline
~/.screenrc
startup_message off
autodetach on
term screen-256color
vbell off
defscrollback 10000
termcapinfo xterm|xterms|xs|rxvt ti@:te@
backtick 1 3600 900 "/home/jordz/tmp/arch-updates/updates.pl"
hardstatus alwayslastline "%{= kw}%{g}[ %{G}%H %{g}] %{Y}pkgs: %{w}%1` %{g}[%=%{ =kw}%{w}%-w%{Y}[%{W}%n-%t%{Y}]%{w}%+w%=%{g}][ %{w}%d-%m %{Y}%c %{g}]"
screen -t htop htop
screen -t bash bash
updates.pl + hourly cron: pacman -Sy
#!/usr/bin/perl
use strict;
use warnings;
print ((`pacman -Qu` =~ m/^[^\s]+\s\((\d+)\):/m) ? $1 : 0);
Offline
Offline
dholt: That looks great, but where's the .screenrc?
Offline
dholt: That looks great, but where's the .screenrc?
Made me lol.
Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.
Offline
Bottom bar is dwm's status bar
.screenrc
startup_message off
#termcapinfo xterm*|Eterm|mlterm|rxvt 'hs:ts=\E]0;:fs=\007:ds=\E]0;screen\007'
termcapinfo rxvt-unicode ti@:te@ #enable SHIFT-PGUP / SHIFT-PGDOWN scroll
#termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J
terminfo rxvt-unicode ti@:te@:
term screen-256color
setenv LC_CTYPE en_US.UTF-8
defutf8 on
setenv DISPLAY ':0'
nonblock on
vbell off
msgwait 10
shelltitle ''
#defmonitor on
screen -t '' 1
screen -t '' 2
screen -t '' 3
screen -t '' 4
screen -t '' 5
screen -t '' 6
screen -t '' 7 top
screen -t '' 8 sudo inotail -f -n 30 /var/log/everything.log
screen -t '' 9
#select 9
bind = resize =
bind + resize +1
bind - resize -1
bind _ resize max
bind c screen 1 # Window numbering starts at 1, not 0.
bind 0 select 10
# make life easier, f1-f10 selects screens 0-9
#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 k0 select 0
# windows select with Shift-Fn. May not work in all terminals.
# (screen only seems to understand up to FA)
#bindkey -k F3 select 1
#bindkey -k F4 select 2
#bindkey -k F5 select 3
#bindkey -k F6 select 4
#bindkey -k F7 select 5
#bindkey -k F8 select 6
#bindkey -k F9 select 7
#bindkey -k FA select 8
#bindkey -k k7 detach # bind F7 to detach screen session from this terminal
#bindkey -k k8 kill # bind F8 to kill current screen window.
#bindkey -k k9 next # bind F9 to move to previous window
#bindkey -k F1 prev # bind F11 to move to next window
#bindkey -k F2 hardstatus alwaysignore # F12 to turn the status bar on
#bindkey -k k9 screen # bind F9 to create a new screen
#bindkey -k k; title # bind F10 to rename current screen window
#bindkey -k F1 prev # bind F11 to move to previous window
#bindkey -k F2 next # bind F12 to move to next window
bindkey "^[Od" prev # change window with ctrl-left
bindkey "^[Oc" next # change window with ctrl-right
#let pgup/pgdn scroll under urxvt (see .Xdefaults)
bindkey "^[[5;2~" eval "copy" "stuff ^u"
bindkey -m "^[[5;2~" stuff ^u
bindkey -m "^[[6;2~" stuff ^d
# add CPU idle/sustem/user/interrupt stats
#backtick 100 5 5 tail -1 /var/tmp/vermaden-stats-top
#caption always '%{= wk} %= %100` %='
#backtick 1 60 60 $HOME/bin/get_uptime
backtick 2 60 60 $HOME/bin/get_cputemp temp1
backtick 3 60 60 $HOME/bin/get_freemem
backtick 4 60 60 $HOME/bin/get_freeswap
backtick 5 60 60 $HOME/bin/get_volume PCM
backtick 6 60 60 $HOME/bin/get_gmail
backtick 7 600 600 $HOME/bin/get_updates
#backtick 8 60 60 $HOME/bin/get_citytemp | grep Temperature | awk '{print $3}'
backtick 9 60 60 $HOME/bin/get_batterycharge
# An alternative hardstatus to display a bar at the bottom listing the
# windownames and highlighting the current windowname in blue. (This is only
# enabled if there is no hardstatus setting for your terminal)
hardstatus on
hardstatus alwayslastline
#hardstatus string "%w"
#hardstatus string "%{.kW}%-w%{.W}%n %t%{-}%+w"
#hardstatus string "%{.kW}%-w%{.W}%n %t%{-}%+w %=%c %d/%m/%Y" #black+white+bold
#hardstatus string "%{.kw}%-w%{.w}%n %t%{-}%+w %=%c %d/%m/%Y" #black+white+normal
#hardstatus string "%{.kw}%-w%{.Kw}%n %t%{-}%+w %=%c %d/%m/%Y" #black+grey+normal
#hardstatus string "%{.kc}%-w%{.kc}%n*%t%{-}%+w %=%c %d/%m/%Y" #black+cyan+normal
hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w %= %2` %3`/%4` %6`/%7` %5`/%9` %c %d/%m/%Y" #black+cyan+normal+white selected
#hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w %= | %1` | %2`C | %3`/%4` | %6`/%7` | %5` | %c %d/%m/%Y" #with dwm status bar
#hardstatus string '%{= kB}%-Lw%{+r}%50> %n%f* %t%{= kB}%+Lw%< %{= kB}%-= %{-}'
#hardstatus alwayslastline '%{bk}[ %{W}%H %{b}][ %{w}%l%{b} ] %{b}[%{w} %D %d.%m %c:%s%{b} ]'
sorendition kw
# hardcopydir: The directory which contains all hardcopies.
hardcopydir /home/aleyscha/.hardcopy
Last edited by leo2501 (2009-02-15 19:40:57)
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery
Offline
Bottom bar is dwm's status bar
.screenrc
startup_message off #termcapinfo xterm*|Eterm|mlterm|rxvt 'hs:ts=\E]0;:fs=\007:ds=\E]0;screen\007' termcapinfo rxvt-unicode ti@:te@ #enable SHIFT-PGUP / SHIFT-PGDOWN scroll #termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J terminfo rxvt-unicode ti@:te@: term screen-256color setenv LC_CTYPE en_US.UTF-8 defutf8 on setenv DISPLAY ':0' nonblock on vbell off msgwait 10 shelltitle '' #defmonitor on screen -t '' 1 screen -t '' 2 screen -t '' 3 screen -t '' 4 screen -t '' 5 screen -t '' 6 screen -t '' 7 top screen -t '' 8 sudo inotail -f -n 30 /var/log/everything.log screen -t '' 9 #select 9 bind = resize = bind + resize +1 bind - resize -1 bind _ resize max bind c screen 1 # Window numbering starts at 1, not 0. bind 0 select 10 # make life easier, f1-f10 selects screens 0-9 #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 k0 select 0 # windows select with Shift-Fn. May not work in all terminals. # (screen only seems to understand up to FA) #bindkey -k F3 select 1 #bindkey -k F4 select 2 #bindkey -k F5 select 3 #bindkey -k F6 select 4 #bindkey -k F7 select 5 #bindkey -k F8 select 6 #bindkey -k F9 select 7 #bindkey -k FA select 8 #bindkey -k k7 detach # bind F7 to detach screen session from this terminal #bindkey -k k8 kill # bind F8 to kill current screen window. #bindkey -k k9 next # bind F9 to move to previous window #bindkey -k F1 prev # bind F11 to move to next window #bindkey -k F2 hardstatus alwaysignore # F12 to turn the status bar on #bindkey -k k9 screen # bind F9 to create a new screen #bindkey -k k; title # bind F10 to rename current screen window #bindkey -k F1 prev # bind F11 to move to previous window #bindkey -k F2 next # bind F12 to move to next window bindkey "^[Od" prev # change window with ctrl-left bindkey "^[Oc" next # change window with ctrl-right #let pgup/pgdn scroll under urxvt (see .Xdefaults) bindkey "^[[5;2~" eval "copy" "stuff ^u" bindkey -m "^[[5;2~" stuff ^u bindkey -m "^[[6;2~" stuff ^d # add CPU idle/sustem/user/interrupt stats #backtick 100 5 5 tail -1 /var/tmp/vermaden-stats-top #caption always '%{= wk} %= %100` %=' #backtick 1 60 60 $HOME/bin/get_uptime backtick 2 60 60 $HOME/bin/get_cputemp temp1 backtick 3 60 60 $HOME/bin/get_freemem backtick 4 60 60 $HOME/bin/get_freeswap backtick 5 60 60 $HOME/bin/get_volume PCM backtick 6 60 60 $HOME/bin/get_gmail backtick 7 600 600 $HOME/bin/get_updates #backtick 8 60 60 $HOME/bin/get_citytemp | grep Temperature | awk '{print $3}' backtick 9 60 60 $HOME/bin/get_batterycharge # An alternative hardstatus to display a bar at the bottom listing the # windownames and highlighting the current windowname in blue. (This is only # enabled if there is no hardstatus setting for your terminal) hardstatus on hardstatus alwayslastline #hardstatus string "%w" #hardstatus string "%{.kW}%-w%{.W}%n %t%{-}%+w" #hardstatus string "%{.kW}%-w%{.W}%n %t%{-}%+w %=%c %d/%m/%Y" #black+white+bold #hardstatus string "%{.kw}%-w%{.w}%n %t%{-}%+w %=%c %d/%m/%Y" #black+white+normal #hardstatus string "%{.kw}%-w%{.Kw}%n %t%{-}%+w %=%c %d/%m/%Y" #black+grey+normal #hardstatus string "%{.kc}%-w%{.kc}%n*%t%{-}%+w %=%c %d/%m/%Y" #black+cyan+normal hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w %= %2` %3`/%4` %6`/%7` %5`/%9` %c %d/%m/%Y" #black+cyan+normal+white selected #hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w %= | %1` | %2`C | %3`/%4` | %6`/%7` | %5` | %c %d/%m/%Y" #with dwm status bar #hardstatus string '%{= kB}%-Lw%{+r}%50> %n%f* %t%{= kB}%+Lw%< %{= kB}%-= %{-}' #hardstatus alwayslastline '%{bk}[ %{W}%H %{b}][ %{w}%l%{b} ] %{b}[%{w} %D %d.%m %c:%s%{b} ]' sorendition kw # hardcopydir: The directory which contains all hardcopies. hardcopydir /home/aleyscha/.hardcopy
Looks awesome!
Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.
Offline
It's not that special so I didn't include it.. but here you go.
startup_message off
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}]'
escape "^ "
bindkey "^[Od" prev
bindkey "^[Oc" next
screen -t bash 0
screen -t bash 1
screen -t ncmpcpp 3 ncmpcpp
screen -t root 4 su -
screen -t rtorrent 5 rtorrent
Offline
Nothing special here as well!
Screenshot
screenrc
startup_message off
vbell off
defscrollback 512
shell -$SHELL
shelltitle sh
autodetach on
# enable SHIFT-PGUP / SHIFT-PGDOWN scroll
termcapinfo rxvt ti@:te@
# change window with ALT-Q ALT-W
bindkey "^[q" prev
bindkey "^[w" next
# F1-F4 switch
# bindkey -k k1 select 1
# bindkey -k k2 select 2
# bindkey -k k3 select 3
# bindkey -k k4 select 4
# unbind defaults
bind ^m
bind ^i
bind ^f
bind ^s
bind ^w
# keyboard shortcuts
bind ^m screen -t mpd ncmpc # C-a-m
bind ^i screen -t icq centericq # C-a-i
bind ^f screen -t fish fish # C-a-f
bind ^s screen -t bge0 slurm -i bge0 # C-a-s
bind ^w screen -t wpi0 slurm -i wpi0 # C-a-w
# startup sessions
screen -t sh 0
screen -t sh 1
select 0
# status
hardstatus alwayslastline '%{= M} %H%{= G} %l %= %{= w}%-w%{+b r}%n*%t%{-b r}%{w}%+w %= %{c}%d %D %{B}%c '
# add CPU idle/sustem/user/interrupt stats
backtick 100 5 5 tail -1 /var/tmp/mprem.stats.top
caption always '%{= wk} %200` %= %100` %='
"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com
Offline
Daisuke, what colorscheme do you use for vim?
Offline
Daisuke, what colorscheme do you use for vim?
Just the tango color scheme mate.
"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com
Offline
fascinating setup i'm sure you will agree
Offline
ste... I'm missing your config file.
I really really have an extremely hard time understanding the status line config in screen, somehow the way the colors act just doesn't make any sense and doesn't resemble any other config I've used, and I never get the colors I'm looking for. Yours happen to be somewhat like my goal.
Offline
ste... I'm missing your config file.
I really really have an extremely hard time understanding the status line config in screen, somehow the way the colors act just doesn't make any sense and doesn't resemble any other config I've used, and I never get the colors I'm looking for. Yours happen to be somewhat like my goal.
Blah. You have to guess, that's the fun part of configuring screen!
Offline
Where do you place backticks and where do they show up in a screen session?
Playing with backtick's
backtick 1 60 60 $HOME/bin/get_uptime backtick 2 60 60 $HOME/bin/get_cputemp Core0 backtick 3 60 60 $HOME/bin/get_freemem backtick 4 60 60 $HOME/bin/get_freeswap backtick 5 60 60 $HOME/bin/get_volume PCM backtick 6 60 60 $HOME/bin/get_gmail backtick 7 60 60 $HOME/bin/get_updates hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w %= | %1` | %2`C | %3`/%4` | %5`% | %6`/%7` | %c %d/%m/%Y"
get_cputemp:
#!/bin/bash sensors | grep $1 | awk '{print $3}' | tr -d +
get_freemem:
#!/bin/bash free -m | grep - | awk '{print $4}'
get_freeswap:
#!/bin/bash free -m | grep Swap | awk '{print $4}'
get_volume:
#!/bin/bash status=$(amixer sget $1 | tail -n 1) vol=$(echo ${status} | gawk '{print $5}' | tr -d [%]) state=$(echo ${status} | gawk '{print $7}') text="${vol}" echo ${text}
get_gmail:
#!/bin/bash gmail_login="xxxxxxxx" gmail_password="xxxxxxxxxxx" dane="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \ https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \ --no-check-certificate | grep 'fullcount' \ | sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)" if [ -z "$dane" ]; then echo "!" else echo "$dane" fi
get_updates:
#! /usr/bin/perl -w use strict; # November 15, 2006 # Daniel Vredenburg (Vredfreak) # This is a program that checks for package updates for Arch Linux users. open (MYINPUTFILE, "/home/aleyscha/bin/arch-updates/updates.log") or die "No such file or directory: $!"; my $i = 0; while(<MYINPUTFILE>) { if (/^(.*)\/(.*)(\..*\..*\.)/) { #print " \n"; $i++; } } if ($i == 0) { print "0"; } else { print "$i"; } close(MYINPUTFILE);
Offline