[ Dustin Kirkland ]

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
-Dustin Kirkland <kirkland@ubuntu.com>Fri, 03 Apr 2009 12:06:45 -0500
This commit is contained in:
Dustin Kirkland 2009-04-03 12:08:11 -05:00
commit 4843026f24
18 changed files with 39 additions and 31 deletions

View file

@ -25,7 +25,7 @@ mhz=`grep -m 1 "^cpu MHz" /proc/cpuinfo | awk -F"[:.]" '{print $2}'` || mhz=`gre
if [ $mhz -ge 1000 ]; then if [ $mhz -ge 1000 ]; then
ghz=$(echo $mhz | awk '{ printf "%.2f", $1 / 1000 }') ghz=$(echo $mhz | awk '{ printf "%.2f", $1 / 1000 }')
echo $ghz"GHz" printf "\005{=b cW}%sGHz\005{-} " $ghz
else else
echo $mhz"MHz" printf "\005{=b cW}%sMHz\005{-} " $mhz
fi fi

View file

@ -95,4 +95,4 @@ if [ "$DETAIL" = "1" ]; then
exit 0 exit 0
fi fi
echo $total_cost printf "\005{= Wg}%s\005{-} " $total_cost

View file

@ -20,5 +20,7 @@
# Default is "off" # Default is "off"
p="hostname" p="hostname"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 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)

View file

@ -21,4 +21,4 @@
p="load-average" p="load-average"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 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)

View file

@ -20,14 +20,16 @@
# Default is on # Default is on
p="mem-available" p="mem-available"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 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}'` mem=`free | grep -m 1 "^Mem:" | awk '{print $2}'`
if [ $mem -ge 1048576 ]; then if [ $mem -ge 1048576 ]; then
mem=$(echo "$mem" | awk '{ printf "%.1f", $1 / 1048576 }') mem=$(echo "$mem" | awk '{ printf "%.1fGB", $1 / 1048576 }')
echo "$mem""GB"
elif [ $mem -ge 1024 ]; then elif [ $mem -ge 1024 ]; then
mem=$(echo "$mem" | awk '{ printf "%.0f", $1 / 1024 }') mem=$(echo "$mem" | awk '{ printf "%.0fMB", $1 / 1024 }')
echo "$mem""MB"
else else
echo "$mem""KB" mem="$mem""KB"
fi fi
printf "\005{=b gW}%s\005{-}%s" "$mem$comma" "$whitespace"

View file

@ -21,4 +21,4 @@
p="mem-used" p="mem-used"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 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)}'

View file

@ -21,4 +21,4 @@
p="menu" p="menu"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0
echo `gettext "Menu:<F9>"` printf " \005{= kw}%s" `gettext "Menu:<F9>"`

View file

@ -21,4 +21,4 @@
p="reboot-required" p="reboot-required"
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && exit 0 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{-} "

View file

@ -29,11 +29,11 @@ if which lsb_release >/dev/null; then
else else
# But for other distros the description # But for other distros the description
# is too long, so build from -i and -r # 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 fi
elif [ -r "/etc/issue" ]; then elif [ -r "/etc/issue" ]; then
# Otherwise, grab part of /etc/issue # 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 else
echo "Unknown" echo "Unknown"
fi fi

View file

@ -29,13 +29,13 @@ print_updates() {
s=$2 s=$2
if [ -n "$u" ]; then if [ -n "$u" ]; then
if [ "$u" -gt 0 ]; then if [ "$u" -gt 0 ]; then
echo -n "$u" printf "\005{=b rW}%d" "$u"
if [ -n "$s" ]; then if [ -n "$s" ]; then
if [ "$s" -gt 0 ]; then if [ "$s" -gt 0 ]; then
echo -n "!" printf "!"
fi fi
fi fi
echo printf "\005{-} "
fi fi
fi fi
exit 0 exit 0

View file

@ -26,11 +26,11 @@ grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
u=$(sed "s/\..*$//" /proc/uptime) u=$(sed "s/\..*$//" /proc/uptime)
if [ "$u" -gt 86400 ]; then 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 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 elif [ "$u" -gt 60 ]; then
printf "%dm" `echo "$u" | awk '{printf "%.0f", $1 / 60 }'` printf "%dm " `echo "$u" | awk '{printf "%.0f", $1 / 60 }'`
else else
printf "%ds" "$u" printf "%ds " "$u"
fi fi

View file

@ -24,4 +24,4 @@
p="users" p="users"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
printf "#%d\005{-} " `who | wc -l` printf "#%d " `who | wc -l`

View file

@ -21,4 +21,4 @@
p="whoami" p="whoami"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0 grep -qs "^$p=1$" "$HOME/.screen-profiles/status" || exit 0
whoami printf "\005{=b }%s\005{-}" $(whoami)

8
debian/changelog vendored
View file

@ -1,14 +1,18 @@
screen-profiles (1.43) unreleased; urgency=low screen-profiles (1.43) unreleased; urgency=low
* UNRELEASED [ Dustin Kirkland ]
* bin/logo: allow users to define their own logo * 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 ] [ Raphaël Pinson and Dustin Kirkland ]
* bin/battery, bin/users, bin/uptime, profiles/common, screen-profiles: * bin/battery, bin/users, bin/uptime, profiles/common, screen-profiles:
added new status items for battery state, number of users, and system added new status items for battery state, number of users, and system
uptime uptime
-- Dustin Kirkland <kirkland@ubuntu.com> Fri, 03 Apr 2009 10:45:36 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 03 Apr 2009 12:06:45 -0500
screen-profiles (1.42-0ubuntu1) jaunty; urgency=low screen-profiles (1.42-0ubuntu1) jaunty; urgency=low

View file

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 1.0\n" "Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: 2008-12-22 01:01-0500\n"
"Last-Translator: Nicolas Valcarcel <nvalcarcel@ubuntu.com>\n" "Last-Translator: Nicolas Valcarcel <nvalcarcel@ubuntu.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 1.0\n" "Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: 2008-12-17 23:42+0100\n"
"Last-Translator: Nicolas Barcet <nicolas.barcet@ubuntu.com>\n" "Last-Translator: Nicolas Barcet <nicolas.barcet@ubuntu.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -9,7 +9,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -23,10 +23,10 @@
source /usr/share/screen-profiles/profiles/common source /usr/share/screen-profiles/profiles/common
# Window tabs, second to last line # 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 # 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 # NOTE: Older version of screen have an arbitrary limit of only being able
# to change colors 16 times in this 'hardstatus string'. # to change colors 16 times in this 'hardstatus string'.