screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keeping right aligned text in caption always visible


From: Alex Jurkiewicz
Subject: Re: Keeping right aligned text in caption always visible
Date: Mon, 1 Jun 2009 15:05:23 +0800

2009/6/1 Brian Kroth <address@hidden>:
> I spent a lot of time experimenting with my caption to get something
> like that going, though now that I have it (and haven't touched it in a
> while) I don't remember exactly what the trick was.  I think I guessed
> that the right section would always be about 48 characters and that's
> what the "%-48=" bit is about.
>
> Here's the .screenrc section:
>
> # This adds a statusbar:
> # - windows and their flags before the active one are listed in white and 
> truncated with ...
> # - the active window and it's flags are in bold cyan and aligned slightly to 
> the left
> # - the rest of the windows are printed and truncated so that
> # - a string describing the current machine, load, and date/time are right 
> aligned
> caption always "%{= .w}%-Lw%20L>%{=b .c}%n%f %t%{-}%+Lw %-048= @%H - %l - %D 
> %d %M - %c"
>
> Here's what it looks like on a small terminal window:
>
> ...~ #   2$ ~ $  3$ address@hidden:~ # zl  4$ b... @rolo - 0.00 0.00 0.00 - 
> Sun 31 May - 17:39
>
> Brian
>

Absolute positioning is definitely better than what I have now. The
only problem is that I was hoping to use this line unmodified across a
whole range of servers. There are three workarounds I can think of:
1. Pick an arbitrary number and live with it.
2. Truncate $FULLHOST to a given number of characters and live with that.
3. Rewrite .screenrc on every host to have the right offset. Since my
.screenrc is already automatically created by my shell's .zshrc file
if it's not there, I can probably do this automagically:
[[ ! -f ~/.screenrc ]] && <create .screenrc.temp> && sed -i
"s/043/0$(( 19 + $#FULLHOST ))/" .screenrc.temp && mv .screenrc.temp
~/.screenrc.

I'll go with #3, since I already have half the infrastructure in place.

Thanks for your tip,
AJ




reply via email to

[Prev in Thread] Current Thread [Next in Thread]