diff --git a/bin/cpu-freq b/bin/cpu-freq index 9efd465a..01c36ba9 100755 --- a/bin/cpu-freq +++ b/bin/cpu-freq @@ -25,7 +25,7 @@ mhz=`grep -m 1 "^cpu MHz" /proc/cpuinfo | awk -F"[:.]" '{print $2}'` || mhz=`gre if [ $mhz -ge 1000 ]; then ghz=$(echo $mhz | awk '{ printf "%.2f", $1 / 1000 }') - echo $ghz"GHz" + printf "\005{=b cW}%sGHz\005{-} " $ghz else - echo $mhz"MHz" + printf "\005{=b cW}%sMHz\005{-} " $mhz fi diff --git a/bin/ec2-cost b/bin/ec2-cost index 772a2436..186aa100 100755 --- a/bin/ec2-cost +++ b/bin/ec2-cost @@ -95,4 +95,4 @@ if [ "$DETAIL" = "1" ]; then exit 0 fi -echo $total_cost +printf "\005{= Wg}%s\005{-} " $total_cost diff --git a/bin/hostname b/bin/hostname index ebe3ec88..11855b87 100755 --- a/bin/hostname +++ b/bin/hostname @@ -20,5 +20,7 @@ # Default is "off" p="hostname" grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 +at= +grep -qs "^whoami=1$" "$HOME/.screen-profiles/status" && at="@" -echo "@"`hostname -s` +printf "\005{=b }%s%s\005{-}" "$at" $(hostname -s) diff --git a/bin/load-average b/bin/load-average index 08cfa8a1..fb9176b7 100755 --- a/bin/load-average +++ b/bin/load-average @@ -21,4 +21,4 @@ p="load-average" grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 -cat /proc/loadavg | cut -d " " -f -1 +printf "\005{= Yk}%s\005{-} " $(cat /proc/loadavg | cut -d " " -f -1) diff --git a/bin/mem-available b/bin/mem-available index 46fb3d6d..294c616f 100755 --- a/bin/mem-available +++ b/bin/mem-available @@ -20,14 +20,16 @@ # Default is on p="mem-available" grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 +comma= +whitespace= +grep -qs "^mem-used=1$" "$HOME/.screen-profiles/status" && comma="," || whitespace=" " mem=`free | grep -m 1 "^Mem:" | awk '{print $2}'` if [ $mem -ge 1048576 ]; then - mem=$(echo "$mem" | awk '{ printf "%.1f", $1 / 1048576 }') - echo "$mem""GB" + mem=$(echo "$mem" | awk '{ printf "%.1fGB", $1 / 1048576 }') elif [ $mem -ge 1024 ]; then - mem=$(echo "$mem" | awk '{ printf "%.0f", $1 / 1024 }') - echo "$mem""MB" + mem=$(echo "$mem" | awk '{ printf "%.0fMB", $1 / 1024 }') else - echo "$mem""KB" + mem="$mem""KB" fi +printf "\005{=b gW}%s\005{-}%s" "$mem$comma" "$whitespace" diff --git a/bin/mem-used b/bin/mem-used index 05779809..f8c9d1f1 100755 --- a/bin/mem-used +++ b/bin/mem-used @@ -21,4 +21,4 @@ p="mem-used" grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 -free | awk '/buffers\/cache:/ {printf ",%.0f%%\n", 100*$3/($3 + $4)}' +free | awk '/buffers\/cache:/ {printf "\005{=b gW}%.0f%%\005{-} ", 100*$3/($3 + $4)}' diff --git a/bin/menu b/bin/menu index c5bb494e..9af5f173 100755 --- a/bin/menu +++ b/bin/menu @@ -21,4 +21,4 @@ p="menu" grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 -echo `gettext "Menu:"` +printf " \005{= kw}%s" `gettext "Menu:"` diff --git a/bin/reboot-required b/bin/reboot-required index 8a32b345..2a9909e7 100755 --- a/bin/reboot-required +++ b/bin/reboot-required @@ -21,4 +21,4 @@ p="reboot-required" grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 -[ -e /var/run/reboot-required ] && echo "(@)" +[ -e /var/run/reboot-required ] && printf "\005{=b bW}(@)\005{-} " diff --git a/bin/release b/bin/release index de47ccff..826306ce 100755 --- a/bin/release +++ b/bin/release @@ -29,11 +29,11 @@ if which lsb_release >/dev/null; then else # But for other distros the description # is too long, so build from -i and -r - echo $(lsb_release -s -i) $(lsb_release -s -r) + printf "\005{=b }%s %s\005{-} " $(lsb_release -s -i) $(lsb_release -s -r) fi elif [ -r "/etc/issue" ]; then # Otherwise, grab part of /etc/issue - head -n1 /etc/issue | awk '{print $1}' + printf "\005{=b ..}%s\005{-} " $(head -n1 /etc/issue | awk '{print $1}') else echo "Unknown" fi diff --git a/bin/updates-available b/bin/updates-available index fcedcd1e..97b1075e 100755 --- a/bin/updates-available +++ b/bin/updates-available @@ -29,13 +29,13 @@ print_updates() { s=$2 if [ -n "$u" ]; then if [ "$u" -gt 0 ]; then - echo -n "$u" + printf "\005{=b rW}%d" "$u" if [ -n "$s" ]; then if [ "$s" -gt 0 ]; then - echo -n "!" + printf "!" fi fi - echo + printf "\005{-} " fi fi exit 0 diff --git a/bin/uptime b/bin/uptime index 58dcb77d..b0bf4b79 100755 --- a/bin/uptime +++ b/bin/uptime @@ -26,11 +26,11 @@ grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 u=$(sed "s/\..*$//" /proc/uptime) if [ "$u" -gt 86400 ]; then - printf "%dd" `echo "$u" | awk '{printf "%.0f", $1 / 86400 }'` + printf "%dd " `echo "$u" | awk '{printf "%.0f", $1 / 86400 }'` elif [ "$u" -gt 3600 ]; then - printf "%dh" `echo "$u" | awk '{printf "%.0f", $1 / 3600 }'` + printf "%dh " `echo "$u" | awk '{printf "%.0f", $1 / 3600 }'` elif [ "$u" -gt 60 ]; then - printf "%dm" `echo "$u" | awk '{printf "%.0f", $1 / 60 }'` + printf "%dm " `echo "$u" | awk '{printf "%.0f", $1 / 60 }'` else - printf "%ds" "$u" + printf "%ds " "$u" fi diff --git a/bin/users b/bin/users index a43bf141..233bd5fe 100755 --- a/bin/users +++ b/bin/users @@ -24,4 +24,4 @@ p="users" grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 -printf "#%d\005{-} " `who | wc -l` +printf "#%d " `who | wc -l` diff --git a/bin/whoami b/bin/whoami index c002ae21..9356d2ab 100755 --- a/bin/whoami +++ b/bin/whoami @@ -21,4 +21,4 @@ p="whoami" grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 -whoami +printf "\005{=b }%s\005{-}" $(whoami) diff --git a/debian/changelog b/debian/changelog index cd86b1a9..95b40b3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,14 +1,18 @@ screen-profiles (1.43) unreleased; urgency=low - * UNRELEASED + [ Dustin Kirkland ] * bin/logo: allow users to define their own logo + * bin/*, profiles/profile.skel: make all status scripts handle their + own colors and trailing whitespace; this should help alleviate the + 16-color-change limitation on un-patched screens; it also simplifies + the hardstatus string significantly [ Raphaƫl Pinson and Dustin Kirkland ] * bin/battery, bin/users, bin/uptime, profiles/common, screen-profiles: added new status items for battery state, number of users, and system uptime - -- Dustin Kirkland Fri, 03 Apr 2009 10:45:36 -0500 + -- Dustin Kirkland Fri, 03 Apr 2009 12:06:45 -0500 screen-profiles (1.42-0ubuntu1) jaunty; urgency=low diff --git a/po/es.po b/po/es.po index d6b4d64e..45261b97 100644 --- a/po/es.po +++ b/po/es.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-04-03 11:01-0500\n" +"POT-Creation-Date: 2009-04-03 12:03-0500\n" "PO-Revision-Date: 2008-12-22 01:01-0500\n" "Last-Translator: Nicolas Valcarcel \n" "Language-Team: LANGUAGE \n" diff --git a/po/fr.po b/po/fr.po index 6895dfd9..37a9d347 100644 --- a/po/fr.po +++ b/po/fr.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-04-03 11:01-0500\n" +"POT-Creation-Date: 2009-04-03 12:03-0500\n" "PO-Revision-Date: 2008-12-17 23:42+0100\n" "Last-Translator: Nicolas Barcet \n" "Language-Team: LANGUAGE \n" diff --git a/po/screen-profiles.pot b/po/screen-profiles.pot index f0b19a23..c4854258 100644 --- a/po/screen-profiles.pot +++ b/po/screen-profiles.pot @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-04-03 11:01-0500\n" +"POT-Creation-Date: 2009-04-03 12:03-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/profiles/profile.skel b/profiles/profile.skel index 5a24ff5a..e738484b 100644 --- a/profiles/profile.skel +++ b/profiles/profile.skel @@ -23,10 +23,10 @@ source /usr/share/screen-profiles/profiles/common # Window tabs, second to last line -caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{=b Wk}%110`%109` %{= kw}%111`" +caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{= Wk}%110`%109`%111`" # Status string, last line -hardstatus string '%99`%{=b Wk} %100` %{= Wk}%112` %= %113`%{=b Wk}%114`%{=b Wk}%115`%{=b Wk} %{=b bW}%102`%{= Wk} %{=b rW}%101`%{= Wk} %{= Wg}%108`%{= Wk} %{= Yk}%106`%{= Wk} %{= Wk}%104`%{=b cW}%103`%{= Wk} %{=b gW}%105`%107`%{= Wk} %Y-%m-%d %0c:%s' +hardstatus string '%{= Wk}%99`%{= Wk} %100`%112`%= %115`%114`%108`%113`%102`%101`%106`%104`%103`%105`%107`%Y-%m-%d %0c:%s' # NOTE: Older version of screen have an arbitrary limit of only being able # to change colors 16 times in this 'hardstatus string'.