You are not logged in.
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 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
At the risk of breaking thread formatting:
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
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!!
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
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
# 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
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
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
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
I needed this! Great thread.
A bus station is where a bus stops.
A train station is where a train stops.
On my desk I have a workstation.
Offline
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
*quickly copies configs and saves to file for future reference*
Mine is a slightly modified version of phrak's.
Offline
codemac I'm in need of a little more enlightenment :!:
:? Where do you change your prompt? And can I see the configuration for yours?
Thanks again for your help!
Offline
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
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
codemac I'm in need of a little more enlightenment :!:
:? 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
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
Offline
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
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
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
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
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
klapmuetz winz. The place he linked is where I got mine.
Offline
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!
Offline
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
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
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
Thank you for bringing screen to my attention. I had never heard of it before and now I consider it essential.
Offline
klapmuetz
Thanks for the very clear explanation!! That really helps us newbies!
Rick
Offline