From e53cdaa0a14db3e81b6ae946d49fc1f165654069 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Mon, 23 Nov 2009 23:19:09 -0600 Subject: [PATCH] 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 --- byobu-status | 48 ++++++++++++++++++--------------- debian/changelog | 4 +++ profiles/common | 1 + profiles_generator/profile.skel | 4 +-- statusrc | 2 ++ 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/byobu-status b/byobu-status index 5bb18b85..47f5940a 100755 --- a/byobu-status +++ b/byobu-status @@ -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 diff --git a/debian/changelog b/debian/changelog index f9c184ba..262bd0ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Tue, 10 Nov 2009 10:18:20 -0600 diff --git a/profiles/common b/profiles/common index c047bbd7..18f78c41 100644 --- a/profiles/common +++ b/profiles/common @@ -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 diff --git a/profiles_generator/profile.skel b/profiles_generator/profile.skel index 839cb152..8ae7227a 100644 --- a/profiles_generator/profile.skel +++ b/profiles_generator/profile.skel @@ -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'. diff --git a/statusrc b/statusrc index 49fde1fe..dceb5d19 100644 --- a/statusrc +++ b/statusrc @@ -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}"