byobu-status, profiles/common, profiles_generator/profile.skel,

statusrc: obviate the need for separate profiles per color; read the
profile colors from a config file, and use a special "color" status
item to dynamically render it
This commit is contained in:
Dustin Kirkland 2009-11-23 23:19:09 -06:00
commit e53cdaa0a1
5 changed files with 36 additions and 23 deletions

View file

@ -36,27 +36,33 @@ find_script () {
[ -r "$HOME/.$PKG/statusrc" ] && . "$HOME/.$PKG/statusrc"
export P="$1"
if [ "$P" = "--detail" ]; then
VER=
if which dpkg-query >/dev/null; then
VER=`dpkg-query --show $PKG | awk '{print "-" $2 }'`
fi
printf "$PKG$VER Detailed Status Navigation\n Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"
if [ -d "$HOME/.$PKG/bin" ]; then
DIR="$HOME/.$PKG/bin"
else
DIR="/usr/lib/$PKG"
fi
for i in `ls "$DIR"`; do
[ "$i" = "menu" ] && continue
script=`find_script $i`
short=`$script --short | sed 's/^\s*//' | sed 's/\s*$//' | sed 's/.{[^}]*}//g'` || true
detail=`$script --detail | sed '/^$/d' | sed 's/^/\t/g'` || true
printf "%s\n\t(%s)\n" "$short" "$i"
[ -n "$detail" ] && printf "%s\n" "$detail"
done
else
case "$P" in
--detail)
VER=
if which dpkg-query >/dev/null; then
VER=`dpkg-query --show $PKG | awk '{print "-" $2 }'`
fi
printf "$PKG$VER Detailed Status Navigation\n Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"
if [ -d "$HOME/.$PKG/bin" ]; then
DIR="$HOME/.$PKG/bin"
else
DIR="/usr/lib/$PKG"
fi
for i in `ls "$DIR"`; do
[ "$i" = "menu" ] && continue
script=`find_script $i`
short=`$script --short | sed 's/^\s*//' | sed 's/\s*$//' | sed 's/.{[^}]*}//g'` || true
detail=`$script --detail | sed '/^$/d' | sed 's/^/\t/g'` || true
printf "%s\n\t(%s)\n" "$short" "$i"
[ -n "$detail" ] && printf "%s\n" "$detail"
done
;;
color)
[ -r "$HOME/.$PKG/color" ] && . "$HOME/.$PKG/color"
[ -z "$COLOR" ] && printf "$Wk" || printf "$ESC{= $COLOR}"
;;
*)
eval x="\$$P" || exit 1
[ "$x" = "1" ] || exit 0
. $(find_script "$P")
fi
esac

4
debian/changelog vendored
View file

@ -16,6 +16,10 @@ byobu (2.40) unreleased; urgency=low
bin/whoami, bin/wifi_quality statusrc: define a set of color variables,
such that it's easier to make these theme-able
* windows/common: suggest w3m rather than elinks
* byobu-status, profiles/common, profiles_generator/profile.skel,
statusrc: obviate the need for separate profiles per color; read the
profile colors from a config file, and use a special "color" status
item to dynamically render it
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 10 Nov 2009 10:18:20 -0600

View file

@ -35,6 +35,7 @@ defutf8 on
# ~60 ~1 minute
backtick 10 86389 86389 byobu-janitor
backtick 11 86399 86399 printf "\005-1="
backtick 12 86413 86413 byobu-status color
backtick 99 86011 86011 byobu-status logo
backtick 100 599 599 byobu-status release
backtick 101 7 7 byobu-status updates_available

View file

@ -23,10 +23,10 @@
source /usr/share/byobu/profiles/common
# Window tabs, second to last line
caption always "%{kW}%?%-Lw%50L>%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%?%11` %=%{= Wk}%110`%109`%122`%111`%10`%<"
caption always "%12`%?%-Lw%50L>%?%{=b wb}%n*%f %t%?(%u)%?%12`%?%+Lw%?%11` %=%12`%110`%109`%122`%111`%10`%<"
# Status string, last line
hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%129`%127`%114`%115`%108`%128`%125`%126`%113`%119`%117`%116`%106`%104`%103`%105`%107`%123`%120`%121`'
hardstatus string '%99`%12` %100`%112`%= %102`%101`%129`%127`%114`%115`%108`%128`%125`%126`%113`%119`%117`%116`%106`%104`%103`%105`%107`%123`%120`%121`'
# NOTE: Older version of screen have an arbitrary limit of only being able
# to change colors 16 times in this 'hardstatus string'.

View file

@ -63,6 +63,7 @@ gW="$ESC{= gW}"
mw="$ESC{= mw}"
rW="$ESC{= rW}"
kw="$ESC{= kw}"
kW="$ESC{= kW}"
ky="$ESC{= ky}"
kY="$ESC{= kY}"
wb="$ESC{= wb}"
@ -77,6 +78,7 @@ KG="$ESC{= KG}"
MW="$ESC{= MW}"
Rk="$ESC{= Rk}"
Wg="$ESC{= Wg}"
Wk="$ESC{= Wk}"
Wr="$ESC{= Wr}"
Yk="$ESC{= Yk}"