You are not logged in.

#1 2006-04-19 20:43:07

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Screen Configuration.

If you do not know what Gnu Screen is, you should check out this article http://www.kuro5hin.org/story/2004/3/9/16838/14935.

Now that the nubs have been enlightened  :twisted: we can move on to the point of this thread.

SCREEN CONFIGS.

Maybe you have something cool?  share share.

What I'm really looking for here is cool uses of backticks in your hardstatusline, and captionlines that are nice.

caption.png

caption always "%{= kb}[ %{G}%H::$USER %{b}][ %=%{w}%?%-Lw%?%{b}(%{W}%n*%f %t%?(%u)%?%{b})%{w}%?%+Lw%?%?%= %{b}][%{B} %Y.%m.%d %{W}%0c %{b}]"
sorendition +b kG

Offline

#2 2006-04-19 20:48:58

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Screen Configuration.

At the risk of breaking thread formatting:

screenlines.png

All the backticks below are scripts I've written:
NOTE: the GT and LT are below because phpbb strips them as if they were html tags, and html entities don't work in code blocks

# Here comes the pain...
backtick 1 0 0 $HOME/.screen/netinfo 2 wlan0
backtick 2 5 5 $HOME/.screen/batinfo
backtick 3 5 5 $HOME/.screen/cpuinfo
backtick 4 5 5 $HOME/.screen/meminfo
caption always "%{=bu kb} %=LT %?%-Lw%?%{kc}[:%n %t:]%{kb}%?%+Lw%? GT%= "
hardstatus alwayslastline "%{+b bw}[%H :: $USER]%{=b kw} %=[[ %1` | %2` | %3` | %4` ]]%=%{=b bw}[%m.%d.%y %0C%a]"

Here's an example script - it uses screens color escapes to notate battery status (white when charged, green when charging, red when discharging):

#!/bin/sh
#batinfo
stat=` acpi | tr -s ,   | cut -d  -f4 `
pct=` acpi | tr -s ,   | cut -d  -f5 `

color="^E{k.}"
case $stat in
    discharging) color="^E{kr}" ;;
    charging) color="^E{kg}" ;;
    *) color="^E{k.}" ;;
esac

echo "$color$pct^E{-}($color$stat^E{-})"

Offline

#3 2006-04-19 21:01:03

stingray
Member
From: Lima, Peru SA
Registered: 2006-03-24
Posts: 188

Re: Screen Configuration.

codemac wrote:

caption.png

caption always "%{= kb}[ %{G}%H::$USER %{b}][ %=%{w}%?%-Lw%?%{b}(%{W}%n*%f %t%?(%u)%?%{b})%{w}%?%+Lw%?%?%= %{b}][%{B} %Y.%m.%d %{W}%0c %{b}]"
sorendition +b kG

That helps!   And yes, thanks for the enlightenment!! big_smile

You have to remember that to us noobies, stuff like this is like finding gold.  We are learning what our new found freedom is really worth.

Thanks again!

Offline

#4 2006-04-19 21:05:59

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: Screen Configuration.

That's why I started these two threads recently.  It's taken me a long time to find stuff like this, and it really shouldn't be that hard.

Offline

#5 2006-04-19 21:08:08

stingray
Member
From: Lima, Peru SA
Registered: 2006-03-24
Posts: 188

Re: Screen Configuration.

phrakture wrote:
# Here comes the pain...
backtick 1 0 0 $HOME/.screen/netinfo 2 wlan0
backtick 2 5 5 $HOME/.screen/batinfo
backtick 3 5 5 $HOME/.screen/cpuinfo
backtick 4 5 5 $HOME/.screen/meminfo
caption always "%{=bu kb} %=LT %?%-Lw%?%{kc}[:%n %t:]%{kb}%?%+Lw%? GT%= "
hardstatus alwayslastline "%{+b bw}[%H :: $USER]%{=b kw} %=[[ %1` | %2` | %3` | %4` ]]%=%{=b bw}[%m.%d.%y %0C%a]"

Hey, I like how you use the scripts!  Would you mind posting your netinfo script file also?

Thanks!

Offline

#6 2006-04-19 21:40:23

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Screen Configuration.

The netinfo script is handled differently.  The backtick command is specified with a lifetime and span of 0 - telling screen that it should not run the script itself, but instead, watch it in the background and read output from it.

In order to do up/down speeds (which, I think are mathematically off ATM), you need to do something like this, as the only information available is how much info was transfered, not the rate.

This does a few other things too, such as adding the ip and the link quality if wireless.

#!/bin/sh
# netinfo <delay> <interface>

last_rx=0
last_tx=0
while true; do
    ipaddr=` ifconfig $2 | awk '/inet addr/{ split($2,s,/:/); print s[2]; }' `
    if [ $ipaddr != "" ]; then

        link="(` cat /proc/net/wireless | grep $2 | awk '{print $3}' `)"
        prefix="$2[^E{kc}$ipaddr^E{-}$link]"
        stats=` cat /proc/net/dev | grep $2 | tr :  `

        rx=` echo $stats | cut -d  -f2 `
        tx=` echo $stats | cut -d  -f10 `

        up=$(( ( $tx - $last_tx ) / $1 ))
        dn=$(( ( $rx - $last_rx ) / $1 ))

        echo -n "$prefix "
        #note: 8/1024 == 1/128 >> bytes to kilobits
        echo "$up $dn" | awk '{printf "^E{kg}%06.2f^E{kw}/^E{kr}%06.2f^E{kw}n",$1/128,$2/128}'

        last_tx=$tx
        last_rx=$rx
        sleep $1
    else
        echo "$2 not connected"
        sleep 15
    fi
done

Offline

#7 2006-04-19 21:43:03

xterminus
Member
From: Tacoma, WA, USA, Earth, Sol, M
Registered: 2005-10-30
Posts: 93

Re: Screen Configuration.

Here is my screenrc

deflogin on
autodetach on
startup_message off
shell bash
activity "active: %n (%t) [%w:%s]"
bell "bell: %n (%t) [%w:%s]^G"
vbell on
vbell_msg "[[[ ding ]]]"
defscrollback 10000
nonblock on
defutf8 on
msgwait 2

# only Shift+k to kill - prevent accidents
bind k
bind ^k
bind K kill

# Make the xterm scroller work in screen, also works
# with mouse scrollwheel
termcapinfo rxvt ti@:te@
termcapinfo rxvt 'hs:ts=E]2;:fs=07:ds=E]2;screen07' 

# Here comes the pain...
caption always "%{=b dw}:%{-b dw}:%{=b dk}[ %{-b dw}%{-b dc}screen on $USER%{-b dw}@%{-b dc}%H %{=b dk}] [ %= %?%{-b dc}%-Lw%?%{+b dk}(%{+b dw}%n:%t%{+b dk})%?(%u)%?%{-b dw}%?%{-b dc}%+Lw%? %{=b dk}]%{-b dw}:%{+b dw}:" 

backtick 1 300 300 $HOME/dotfiles/screen/weatherinfo 
backtick 2 5 5 $HOME/dotfiles/screen/meminfo
hardstatus alwayslastline "%{+b dw}:%{-b dw}:%{+b dk}[%{-b dc} %0C:%s%a %{=b dk}]-[ %{-b dw}Load%{+b dk}:%{-b dc}%l %{+b dk}] [%{-b dc}%2`%{+b dk}] %=[ %{-b dc}%1`%{=b dk} ]%{-b dw}:%{+b dw}:%<"

sorendition "-b dw"

Offline

#8 2006-04-20 00:15:40

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: Screen Configuration.

Man...I really need to work on my pet project "Config Exchange".  I plan on making a website that will make it easy to post/share/discuss configuration files like this.  I think it would be a great asset to a lot of linux users out there.

Offline

#9 2006-04-20 08:05:59

FUBAR
Member
From: Belgium
Registered: 2004-12-08
Posts: 1,029
Website

Re: Screen Configuration.

I needed this! Great thread. smile


A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.

Offline

#10 2006-04-20 08:18:02

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Screen Configuration.

mine really really blows. it needs some TLC. I copied it from somewhere in a hurry when I setup this computer.

hardstatus alwayslastline "[ % ][ $USER@%H ][ %c:%s ]%=[ %w ]"

which looks like

[ 2 ][ iphitus@sara ][ 12:23:23 ]                                      [ 0 zsh  1 irssi  2* alsamixer ]

James

Offline

#11 2006-04-20 11:21:30

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: Screen Configuration.

*quickly copies configs and saves to file for future reference*

Mine is a slightly modified version of phrak's.

Offline

#12 2006-04-20 15:09:30

stingray
Member
From: Lima, Peru SA
Registered: 2006-03-24
Posts: 188

Re: Screen Configuration.

codemac    I'm in need of a little more enlightenment :!: 

screenexample.png

:? Where do you change your prompt?  And can I see the configuration for yours?

Thanks again for your help!

Offline

#13 2006-04-20 15:51:42

ingvildr
Member
From: Brighton, England
Registered: 2005-04-19
Posts: 203

Re: Screen Configuration.

i'm trying to figure out screen, seems like such a nice tool so far but for my tab bar all i get is bash, never anything like vim or alsamixer that would be nice if i could have that save me remembering numbers all the time, i'm guessing its a bash thing can anyone tell me how its done? oh and thanks for all the good configs my screen looks alot better now.

Offline

#14 2006-04-20 17:30:40

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Screen Configuration.

ingvildr wrote:

i'm trying to figure out screen, seems like such a nice tool so far but for my tab bar all i get is bash, never anything like vim or alsamixer that would be nice if i could have that save me remembering numbers all the time, i'm guessing its a bash thing can anyone tell me how its done? oh and thanks for all the good configs my screen looks alot better now.

The window title defaults to the shell name (set in .screenrc, most likely).  There are tricks to changing it, however.  The most complicated one involes using shell escapes to try to detect the command being run - ugh.

From within a screen session, running "screen foo" starts a new window running "foo".  This will be used as the title, as it's the only thing running in that window (not bash running the app, there is no shell in that window).

You can also use "screen foo -t nifty_title" to name it.  In my .screenrc, I have a few commands like "screen weechat-curses -t irc".

In a running shell, you can change the name via C-a,A (capital means "press shift") and then typing the new title.

Offline

#15 2006-04-20 19:06:49

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: Screen Configuration.

stingray wrote:

codemac    I'm in need of a little more enlightenment :!: 

screenexample.png

:? Where do you change your prompt?  And can I see the configuration for yours?

Thanks again for your help!

I'll get back to you later tonight once I get back to my place.  Basically it's just a ZSH prompt made by ph!l.  It's served me well for a long time big_smile

Note:  I do NOT have the code to make this prompt in bash.  I've seen things that are close, but I never saved them because I use zsh tongue

Offline

#16 2006-04-20 19:19:57

copernikus
Member
From: Philadelphia, PA
Registered: 2005-12-09
Posts: 16

Re: Screen Configuration.

phrakture wrote:

The most complicated one involes using shell escapes to try to detect the command being run - ugh.

Yea, here's a nice site:
http://www.sunsite.ualberta.ca/Document … en_10.html

relevant code for .screenrc

shelltitle '$ |bash'

And I came across this interesting article, although slightly off topic:
http://www.davidpashley.com/articles/xt … -bash.html

-Fran

Offline

#17 2006-04-20 19:59:19

stingray
Member
From: Lima, Peru SA
Registered: 2006-03-24
Posts: 188

Re: Screen Configuration.

codemac wrote:

I'll get back to you later tonight once I get back to my place.  Basically it's just a ZSH prompt made by ph!l.  It's served me well for a long time big_smile

Note:  I do NOT have the code to make this prompt in bash.  I've seen things that are close, but I never saved them because I use zsh tongue

Sounds Great!  I've been playing with zsh also, but without any custom configuration files, so it is very gray and bare.

Thanks again for your help, all your Enlightenment.  8)

Offline

#18 2006-04-20 20:39:45

klapmuetz
Member
From: Germany
Registered: 2005-03-19
Posts: 75

Re: Screen Configuration.

http://aperiodic.net/phil/prompt/

I've been using this very prompt since '02 or something... People seemed to say it's very flashy but I always thought it was very nice. And it was done for me, that's even better. :-D

I recently... Dunno (3 months, or something) stripped it a little down... to just display this:

http://benny.klpmtz.de/root.png

I went from huge to kind of minimalistc, it doesn't even display the user name any longer... :-D


Hello girls, I like rock climbing, mountain biking and rafting! Write me!

Offline

#19 2006-04-21 02:19:04

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: Screen Configuration.

klapmuetz winz.  The place he linked is where I got mine.

Offline

#20 2006-04-21 02:46:00

stingray
Member
From: Lima, Peru SA
Registered: 2006-03-24
Posts: 188

Re: Screen Configuration.

codemac wrote:

klapmuetz winz.  The place he linked is where I got mine.

Yep, I've been playing around with klapmuetz's info, looks good!

Thanks guys for all your help!

One thing I've learned, Linux has given me a thousand ways to "tweek" the time away! smile

Offline

#21 2006-04-21 06:34:21

klapmuetz
Member
From: Germany
Registered: 2005-03-19
Posts: 75

Re: Screen Configuration.

codemac wrote:

klapmuetz winz.  The place he linked is where I got mine.

Yeah, probably because I linked it to you on the mailing list :-D


Hello girls, I like rock climbing, mountain biking and rafting! Write me!

Offline

#22 2006-04-21 13:25:29

stingray
Member
From: Lima, Peru SA
Registered: 2006-03-24
Posts: 188

Re: Screen Configuration.

I've got http://aperiodic.net/phil/prompt/ working by putting the code into /home/rick/.zshrc and also in /root/.zshrc for root. Where would i put it for all users?  looking at the "man zsh" it looks like I would put it in /etc/zshrc.  I've tried that, removed my other .zshrc files but it doesn't pick it up.

Same idea with .bashrc

Any ideas?

Offline

#23 2006-04-21 17:39:50

klapmuetz
Member
From: Germany
Registered: 2005-03-19
Posts: 75

Re: Screen Configuration.

stingray wrote:

Any ideas?

If you experience unusual behaviour, even if the manpage clearly states it should work like this... Do the following: (In our example it's zsh :-)

# abs
# cd /var/abs
# find . -name "zsh"
# cd ./extra/system/zsh

open up the PKGBUILD and check the configure flags...

In our case this will reveal the following:
--enable-etcdir=/etc/zsh

This means that the system wide zshrc has to be placed inside /etc/zsh
instead of the /etc (like the manpage thinks.)

HTH,
klap


Hello girls, I like rock climbing, mountain biking and rafting! Write me!

Offline

#24 2006-04-22 09:19:39

whyte
Member
Registered: 2006-04-15
Posts: 10

Re: Screen Configuration.

Thank you for bringing screen to my attention. I had never heard of it before and now I consider it essential.

Offline

#25 2006-04-22 20:13:30

stingray
Member
From: Lima, Peru SA
Registered: 2006-03-24
Posts: 188

Re: Screen Configuration.

klapmuetz

Thanks for the very clear explanation!!  That really helps us newbies!  smile

Rick

Offline

Board footer

Powered by FluxBB