From ae4660675ac7074082a568598575cf4941d7988c Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Fri, 3 Jul 2009 16:09:31 -0700 Subject: [PATCH] * bin/fan_speed, byobu-config, byobu.1, profiles/common, profiles_generator/profile.skel, rpm/byobu.spec, statusrc: added cpu fan speed status Signed-off-by: Dustin Kirkland --- bin/fan_speed | 33 +++++++++++++++++++++++++++++++++ byobu-config | 1 + byobu.1 | 2 ++ debian/changelog | 5 ++++- profiles/common | 1 + profiles_generator/profile.skel | 2 +- rpm/byobu.spec | 1 + statusrc | 1 + 8 files changed, 44 insertions(+), 2 deletions(-) create mode 100755 bin/fan_speed diff --git a/bin/fan_speed b/bin/fan_speed new file mode 100755 index 00000000..99c7eb74 --- /dev/null +++ b/bin/fan_speed @@ -0,0 +1,33 @@ +#!/bin/sh -e +# +# fan_speed: speed of the cpu or case fan +# Copyright (C) 2009 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="/sys/class/hwmon" +if [ "$1" = "--detail" ]; then + for i in `ls $DIR 2>/dev/null`; do + echo "$i:" + cat "$DIR/$i"/* 2>/dev/null + done + exit 0 +fi + +for i in `ls "$DIR/"*"/device/fan"* 2>/dev/null`; do + printf "\005{=b }%s\005{-}\005{= }rpm\005{-} " `cat $i` + break +done diff --git a/byobu-config b/byobu-config index c004cf33..1b98b2f7 100755 --- a/byobu-config +++ b/byobu-config @@ -271,6 +271,7 @@ def readstatus(): status["date"]=1 status["disk"]=0 status["ec2_cost"]=0 + status["fan_speed"]=0 status["hostname"]=0 status["ip_address"]=0 status["load_average"]=1 diff --git a/byobu.1 b/byobu.1 index 645f4f79..25eda4b4 100644 --- a/byobu.1 +++ b/byobu.1 @@ -27,6 +27,8 @@ byobu \- wrapper script for seeding a user's byobu configuration and launching s \fBec2_cost\fP \- an estimation of the cost of the current boot of the system in terms of the Amazon EC2 billing model; displayed in the lower bar toward the right in green text on a grey background; there is a leading '~' to indicate that this is an estimation, and the monetary units are US Dollars '$' +\fBfan_speed\fP \- cpu or system fan speed as reported by lm-sensors; displayed in the lower bar toward the right in black text on a grey background; there is a trailing 'rpm' for units + \fBhostname\fP \- the hostname of the system; displayed in the upper bar on the far right in bold black text on a grey background; there is a leading '@' symbol if the username status is also enabled \fBip_address\fP \- the ip address of the system in dotted decimal form; displayed in the upper bar on the far right in bold black text on a grey background diff --git a/debian/changelog b/debian/changelog index f1169132..1a72b379 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,11 @@ byobu (2.19) unreleased; urgency=low * bin/temp_c, bin/temp_f: fix display of yellow on dark tty's * bin/*: use bold for measurements, and non-bold for units; this really makes byobu's status items 'pop'! + * bin/fan_speed, byobu-config, byobu.1, profiles/common, + profiles_generator/profile.skel, rpm/byobu.spec, statusrc: added cpu + fan speed status - -- Dustin Kirkland Fri, 03 Jul 2009 15:46:49 -0700 + -- Dustin Kirkland Fri, 03 Jul 2009 16:09:08 -0700 byobu (2.18-0ubuntu1) karmic; urgency=low diff --git a/profiles/common b/profiles/common index ee6e45a7..02022e6b 100644 --- a/profiles/common +++ b/profiles/common @@ -63,6 +63,7 @@ backtick 124 86117 86117 true backtick 125 19 19 byobu-status temp_c backtick 126 19 19 byobu-status temp_f backtick 127 5 5 byobu-status mail +backtick 128 23 23 byobu-status fan_speed hardstatus alwayslastline diff --git a/profiles_generator/profile.skel b/profiles_generator/profile.skel index 370c0cda..68c5d965 100644 --- a/profiles_generator/profile.skel +++ b/profiles_generator/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`%10`" # Status string, last line -hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%127`%114`%115`%108`%125`%126`%113`%119`%117`%116`%106`%104`%103`%105`%107`%123`%120`%121`' +hardstatus string '%99`%{= Wk} %100`%112`%= %102`%101`%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/rpm/byobu.spec b/rpm/byobu.spec index 1809d808..e1e39eb6 100644 --- a/rpm/byobu.spec +++ b/rpm/byobu.spec @@ -79,6 +79,7 @@ rm -rf $RPM_BUILD_ROOT /usr/lib/byobu/date /usr/lib/byobu/disk /usr/lib/byobu/ec2_cost +/usr/lib/byobu/fan_speed /usr/lib/byobu/hostname /usr/lib/byobu/ip_address /usr/lib/byobu/load_average diff --git a/statusrc b/statusrc index da351c47..45317847 100644 --- a/statusrc +++ b/statusrc @@ -25,6 +25,7 @@ cpu_freq=1 date=1 disk=0 ec2_cost=0 +fan_speed=0 hostname=0 ip_address=0 load_average=1