* bin/temp-c, bin/temp-f, byobu-config, byobu-config.1, byobu-status,

profiles/common, profiles/profile.skel, rpm/byobu.spec: added a
    cpu temperature indicator


Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-05-20 12:10:21 +02:00
commit 943fa10f58
9 changed files with 76 additions and 4 deletions

33
bin/temp-c Executable file
View file

@ -0,0 +1,33 @@
#!/bin/sh -e
#
# temp-c: cpu temperature in celsius
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
DIR="/proc/acpi/thermal_zone"
if [ "$1" = "--detail" ]; then
for i in `ls $DIR`; do
echo "$i:"
cat "$DIR/$i"/*
done
exit 0
fi
if [ -r "$DIR/THM0/temperature" ]; then
t=$(sed "s/^[^0-9]\+//" "$DIR"/THM0/temperature | sed "s/\s.*$//")
printf "\005{= kY}%sC\005{-} " "$t"
fi

29
bin/temp-f Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh -e
#
# temp-f: cpu temperature in farenheit
# Copyright (C) 2008 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
DIR="/proc/acpi/thermal_zone"
if [ "$1" = "--detail" ]; then
exit 0
fi
if [ -r "$DIR/THM0/temperature" ]; then
t=$(sed "s/^[^0-9]\+//" "$DIR"/THM0/temperature | sed "s/\s.*$//" | awk '{printf "%.0f", $1 *9/5 + 32}')
printf "\005{= kY}%sF\005{-} " "$t"
fi

View file

@ -265,6 +265,8 @@ def readstatus():
status["processes"]=0 status["processes"]=0
status["reboot-required"]=1 status["reboot-required"]=1
status["release"]=1 status["release"]=1
status["temp-c"]=0
status["temp-f"]=0
status["time"]=1 status["time"]=1
status["users"]=0 status["users"]=0
status["updates-available"]=1 status["updates-available"]=1

View file

@ -51,6 +51,8 @@ The menu provided by the \fBbyobu\fP should be self-explanatory.
\fBrelease\fP \- distribution and version information about the release running on the current system as reported by \fBlsb_release(1)\fP or \fI/etc/issue\fP; displayed in the lower bar in bold black text toward the left on a grey background \fBrelease\fP \- distribution and version information about the release running on the current system as reported by \fBlsb_release(1)\fP or \fI/etc/issue\fP; displayed in the lower bar in bold black text toward the left on a grey background
\fBtemp\-c\fP, \fBtemp\-f\fP \- the cpu temperature in celsius or farenheit; displayed in the lower bar toward the right in yellow text on a grey background
\fBtime\fP \- the system time in HH:MM:SS format; displayed in the lower bar on the far right in the default text and default background colors \fBtime\fP \- the system time in HH:MM:SS format; displayed in the lower bar on the far right in the default text and default background colors
\fBupdates-available\fP \- the number of updates available on the system; displayed in the lower bar toward the right in white text on a red background with a trailing '!' sign; if any updates are marked 'security updates', then there will be a total of two trailing exclamation points, '!!' \fBupdates-available\fP \- the number of updates available on the system; displayed in the lower bar toward the right in white text on a red background with a trailing '!' sign; if any updates are marked 'security updates', then there will be a total of two trailing exclamation points, '!!'

View file

@ -63,7 +63,7 @@ case "$P" in
grep -qs -m1 "^$P=0$" "$HOME/.$PKG/status" && exit 0 grep -qs -m1 "^$P=0$" "$HOME/.$PKG/status" && exit 0
;; ;;
# default = off, user must override to turn on # default = off, user must override to turn on
arch|battery|disk-available|disk-used|ec2-cost|hostname|ip-address|network-down|network-up|processes|users|whoami|wifi-quality) arch|battery|disk-available|disk-used|ec2-cost|hostname|ip-address|network-down|network-up|processes|users|temp-c|temp-f|whoami|wifi-quality)
grep -qs -m1 "^$P=1$" "$HOME/.$PKG/status" || exit 0 grep -qs -m1 "^$P=1$" "$HOME/.$PKG/status" || exit 0
;; ;;
--detail) --detail)

6
debian/changelog vendored
View file

@ -1,8 +1,10 @@
byobu (2.5) unreleased; urgency=low byobu (2.5) unreleased; urgency=low
* UNRELEASED * bin/temp-c, bin/temp-f, byobu-config, byobu-config.1, byobu-status,
profiles/common, profiles/profile.skel, rpm/byobu.spec: added a
cpu temperature indicator
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 18 May 2009 19:24:24 +0200 -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 20 May 2009 12:08:35 +0200
byobu (2.4-0ubuntu1) karmic; urgency=low byobu (2.4-0ubuntu1) karmic; urgency=low

View file

@ -52,6 +52,8 @@ backtick 121 86400 86400 byobu-status time
backtick 122 3600 3600 byobu-status ip-address backtick 122 3600 3600 byobu-status ip-address
backtick 123 86400 86400 byobu-status disk-available backtick 123 86400 86400 byobu-status disk-available
backtick 124 2 2 byobu-status disk-used backtick 124 2 2 byobu-status disk-used
backtick 125 30 30 byobu-status temp-c
backtick 126 30 30 byobu-status temp-f
hardstatus alwayslastline hardstatus alwayslastline

View file

@ -26,7 +26,7 @@ source /usr/share/byobu/profiles/common
caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{= Wk}%110`%109`%122`%111`" caption always "%{kW}%?%-Lw%?%{bw}%n*%f %t%?(%u)%?%{kW}%?%+Lw%? %= %{= Wk}%110`%109`%122`%111`"
# Status string, last line # Status string, last line
hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%114`%115`%108`%113`%119`%117`%118`%116`%106`%104`%103`%105`%107`%123`%124`%120`%121`' hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%114`%115`%108`%125`%126`%113`%119`%117`%118`%116`%106`%104`%103`%105`%107`%123`%124`%120`%121`'
# 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'.

View file

@ -116,6 +116,8 @@ rm -rf $RPM_BUILD_ROOT
/usr/lib/byobu/processes /usr/lib/byobu/processes
/usr/lib/byobu/reboot-required /usr/lib/byobu/reboot-required
/usr/lib/byobu/release /usr/lib/byobu/release
/usr/lib/byobu/temp-c
/usr/lib/byobu/temp-f
/usr/lib/byobu/time /usr/lib/byobu/time
/usr/lib/byobu/updates-available /usr/lib/byobu/updates-available
/usr/lib/byobu/uptime /usr/lib/byobu/uptime