diff --git a/bin/temp-c b/bin/temp-c new file mode 100755 index 00000000..8a780864 --- /dev/null +++ b/bin/temp-c @@ -0,0 +1,33 @@ +#!/bin/sh -e +# +# temp-c: cpu temperature in celsius +# Copyright (C) 2008 Canonical Ltd. +# +# Authors: Dustin Kirkland + +# 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 . +# + +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 diff --git a/bin/temp-f b/bin/temp-f new file mode 100755 index 00000000..5f2268a9 --- /dev/null +++ b/bin/temp-f @@ -0,0 +1,29 @@ +#!/bin/sh -e +# +# temp-f: cpu temperature in farenheit +# Copyright (C) 2008 Canonical Ltd. +# +# Authors: Dustin Kirkland + +# 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 . +# + +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 diff --git a/byobu-config b/byobu-config index d79df624..e1b23f6d 100755 --- a/byobu-config +++ b/byobu-config @@ -265,6 +265,8 @@ def readstatus(): status["processes"]=0 status["reboot-required"]=1 status["release"]=1 + status["temp-c"]=0 + status["temp-f"]=0 status["time"]=1 status["users"]=0 status["updates-available"]=1 diff --git a/byobu-config.1 b/byobu-config.1 index 326097fe..ad04a89c 100644 --- a/byobu-config.1 +++ b/byobu-config.1 @@ -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 +\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 \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, '!!' diff --git a/byobu-status b/byobu-status index 470f627d..b3c835de 100755 --- a/byobu-status +++ b/byobu-status @@ -63,7 +63,7 @@ case "$P" in grep -qs -m1 "^$P=0$" "$HOME/.$PKG/status" && exit 0 ;; # 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 ;; --detail) diff --git a/debian/changelog b/debian/changelog index fa129c14..824268cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ 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 Mon, 18 May 2009 19:24:24 +0200 + -- Dustin Kirkland Wed, 20 May 2009 12:08:35 +0200 byobu (2.4-0ubuntu1) karmic; urgency=low diff --git a/profiles/common b/profiles/common index bf9f03eb..8b421ff6 100644 --- a/profiles/common +++ b/profiles/common @@ -52,6 +52,8 @@ backtick 121 86400 86400 byobu-status time backtick 122 3600 3600 byobu-status ip-address backtick 123 86400 86400 byobu-status disk-available 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 diff --git a/profiles/profile.skel b/profiles/profile.skel index 7ff320b0..29569297 100644 --- a/profiles/profile.skel +++ b/profiles/profile.skel @@ -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`" # 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 # to change colors 16 times in this 'hardstatus string'. diff --git a/rpm/byobu.spec b/rpm/byobu.spec index 22d615b5..3f2d2e94 100644 --- a/rpm/byobu.spec +++ b/rpm/byobu.spec @@ -116,6 +116,8 @@ rm -rf $RPM_BUILD_ROOT /usr/lib/byobu/processes /usr/lib/byobu/reboot-required /usr/lib/byobu/release +/usr/lib/byobu/temp-c +/usr/lib/byobu/temp-f /usr/lib/byobu/time /usr/lib/byobu/updates-available /usr/lib/byobu/uptime