tempicon -a tray icon to monitor CPU temp

Miscellaneous tools
Message
Author
User avatar
Billtoo
Posts: 3720
Joined: Tue 07 Apr 2009, 13:47
Location: Ontario Canada

tempicon -a tray icon to monitor CPU temp

#31 Post by Billtoo »

This is icewm in Saluki
Attachments
temp.jpg
(11.39 KiB) Downloaded 1847 times

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#32 Post by 01micko »

I've been sitting on this for awhile..

new svg based tempicon remove older versions first!!!

- See main post
Attachments
tray.png
(5.37 KiB) Downloaded 1702 times
Puppy Linux Blog - contact me for access

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#33 Post by DaveS »

01micko wrote:I've been sitting on this for awhile..

new svg based tempicon remove older versions first!!!

- See main post
Excellent. Much easier to read thanks.
Spup Frugal HD and USB
Root forever!

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#34 Post by CatDude »

Hello Mick

Working OK in Slacko-531 (with Compiz + Lxpanel)

I installed lm_sensors-3.1.2 via the PPM then installed the tempicon-0.05.pet

Running the command: sensors-detect
revealed:

Code: Select all

AMD Family 10h thermal sensors...                           Success!
    (driver `k10temp')
but modprobing the module k10temp failed. :(

A quick 'google' lead me to these: with which i was able to build the k10temp module.

I put it in: /lib/modules/2.6.37.6/kernel/drivers/hwmon/
ran depmod
then modprobe k10temp
rebooted and there it was in the system tray of lxpanel. :D

Nice one mate.

CatDude

P.S
Line 6 of: /usr/sbin/tempiconsvg.sh
say's

Code: Select all

ver=0.04
:wink: :wink:
.
Attachments
slacko-531+compiz+lxpanel.png
(4.23 KiB) Downloaded 1676 times
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#35 Post by 01micko »

Minor update v-0.06 -see main post

Thanks CatDude, 06 fixes the version number. Yeah, 2.6.37.6 has k8temp which works with my X2 and nvidia board, I thought it would work for most, wrong I guess! Can you post your module please? I'll whack it in PPM.

Also, pemasu, it *should* install cleanly into woof now, I'll test tonight when I do a build. I left a message on your thread but I now realise it was doomed to fail!
Puppy Linux Blog - contact me for access

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#36 Post by CatDude »

Hi
01micko wrote:...Can you post your module please? I'll whack it in PPM.
Here you go mate.

CatDude
.
Attachments
k10temp-module-slacko-k2.6.37.6.tar.gz
(2.57 KiB) Downloaded 710 times
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

snayak
Posts: 422
Joined: Wed 14 Sep 2011, 05:49

#37 Post by snayak »

Does it work with Wary 500?

Sincerely,
Srinivas Nayak
[Precise 571 on AMD Athlon XP 2000+ with 512MB RAM]
[Fatdog 720 on Intel Pentium B960 with 4GB RAM]

[url]http://srinivas-nayak.blogspot.com/[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#38 Post by technosaurus »

I have made a generic tool to do this using symlinks:
http://www.murga-linux.com/puppy/viewtopic.php?t=76431
you should be able to adjust your backend to only update a single file and the binary is smaller too.

edit: and here is an awk example that I used to generate the svg for my cpu

Code: Select all

#!/bin/ash
awk '{BG = "#00FF00"
if ($2 > 65) BG = "#FFFF00"
if ($2 > 80) BG = "#FF0000"
printf "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"> \
<rect width=\"32\" height=\"22\" x=\"0\" y=\"0\" \
style=\"font-size:%d;fill:%s;fill-opacity:0.75;fill-rule:evenodd;stroke-width:3pt;\" id=\"rect1\" />  \
<text x=\"0\" y=\"18\" style=\"font-size:%d;font-weight:normal;fill-opacity:0.75;stroke-width:3pt;font-family:helvetica;\" id=\"text1\"> \
<tspan id=\"tspan1\">%d°C</tspan> \
</text> \
</svg>",14,BG,14,$2}' /proc/acpi/thermal_zone/TZ01/temperature >test.svg
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#39 Post by mavrothal »

technosaurus wrote:I have made a generic tool to do this using symlinks:
http://www.murga-linux.com/puppy/viewtopic.php?t=76431
you should be able to adjust your backend to only update a single file and the binary is smaller too.

edit: and here is an awk example that I used to generate the svg for my cpu

Code: Select all

#!/bin/ash
awk '{BG = "#00FF00"
if ($2 > 65) BG = "#FFFF00"
if ($2 > 80) BG = "#FF0000"
printf "<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> \
<rect width="32" height="22" x="0" y="0" \
style="font-size:%d;fill:%s;fill-opacity:0.75;fill-rule:evenodd;stroke-width:3pt;" id="rect1" />  \
<text x="0" y="18" style="font-size:%d;font-weight:normal;fill-opacity:0.75;stroke-width:3pt;font-family:helvetica;" id="text1"> \
<tspan id="tspan1">%d°C</tspan> \
</text> \
</svg>",14,BG,14,$2}' /proc/acpi/thermal_zone/TZ01/temperature >test.svg
Tried this and I get:

Code: Select all

awk: cmd. line:4: printf "<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> \ 
awk: cmd. line:4:        ^ unterminated string
awk: cmd. line:4: printf "<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> \ 
awk: cmd. line:4:        ^ syntax error
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#40 Post by technosaurus »

Edit, nope that was just my browser formatting even though html standards told it not to.

the real problem was using the UTF-8 encoded '°' instead of the standard ascii one that I posted ... guess I need to push a tarball to avoid these copy-paste issues (unless maybe you added your own '°' ???)

btw if you ever need an ascii character, I use this a lot to cut/paste from the terminal

Code: Select all

int main() {  
char c=127;
while (c-->=-127) {  
  printf("%d, %c\n",c,c);
}
}
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#41 Post by 01micko »

0.07 is out

Fixes persistent pink message recurrence.

See main post
Puppy Linux Blog - contact me for access

User avatar
pemasu
Posts: 5474
Joined: Wed 08 Jul 2009, 12:26
Location: Finland

#42 Post by pemasu »

:D :D :D

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#43 Post by 01micko »

New version 0.09

See main post

-now compiles the source with a Makefile (devx needed for compilation, not for pet install)
-supports FatDog
-lm_sensors now optional (ymmv - reports please)
-README in source package
-new, rounded corners on icons
-icons are included in PET, no longer generated, faster on older HW
-some minor bugfixes
Puppy Linux Blog - contact me for access

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#44 Post by davids45 »

G'day 01micko,

A little off-topic maybe, but I'm curious why this interesting little utility was not in Slacko (or is it and I couldn't/can't find it)?

I have two computers using high operating temperature CPUs so like to watch how often they get over 70C and to see the background colour change from green to yellow/amber. I assume it would get to red if I find and run the "right" software.

David S.

User avatar
ETP
Posts: 1193
Joined: Tue 19 Oct 2010, 19:55
Location: UK

Tempicon 0.09

#45 Post by ETP »

01micko

Thanks for this latest version. With my 6 year old hardware I found that retaining lm_sensors displays more info. (i.e. max allowable CPU temp)
Attachments
screenshot.44.png
(45.71 KiB) Downloaded 1203 times
Regards ETP
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#46 Post by technosaurus »

@micko I recently made an update to sit:
http://murga-linux.com/puppy/viewtopic.php?t=76431
It should work well with tempicon now that it just monitors each icon to see if it is modified via inotify and directly launches the left and right click apps (no need for a monitor loop any more).

Let me know if you are interested in using it. I think I have simplified it to the maximum extent possible (<20 lines of code) but would like some feedback. (for instance, would it make more sense to fork the click actions, so that icons continue to update while the click event is open?)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#47 Post by 01micko »

@techno

using sit2:

Code: Select all

#!/bin/bash
#set -x
# Records the CPU temp, calls "sit" to display in system tray
# depends: sit[2] (technosaurus http://murga-linux.com/puppy/viewtopic.php?t=76431)
# other unix: +gtkdialog


#########EXPERIMENTAL###########

ver=0.01

PREFIX=`dirname $0`
export PREFIX

PROG=`basename $0`


[ ! -d /tmp/tempsit ] && mkdir /tmp/tempsit
TMPDIR=/tmp/tempsit

#usage
usagefunc(){
echo "	-h|-help -show this help and exit "
echo "	-v|-version -show the $PROG version and exit"
echo "	-t|-togle-startup -Controls if you want to run $PROG at Startup, exits program"
echo "NOTE: Only one argument to $PROG will be allowed"
}

#generate svg
text2svgfunc()
{
FFAMILY=helvetica FFS=14
[ -f /etc/fatdog-version ]&& FFAMILY=sans FFS=13

T=18
[ "$1" -ge "100" ] && T=$FFS
BG="#FF0000" #red (default)
	[ "$1" -le "65" ] && BG="#00FF00" #green
	[[ "$1" -gt "65" && "$1" -le "80" ]] && BG="#FFFF00" #yellow
echo '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect width="32"
     height="22"
     x="0"
     y="0"
     style="font-size:'${T}';fill:'$BG';fill-opacity:0.75;fill-rule:evenodd;stroke-width:3pt;"
     id="rect1" />
  <text
     x="0"
     y="18"
     style="font-size:'${T}';font-weight:normal;fill-opacity:0.75;stroke-width:3pt;font-family:'$FFAMILY';"
     id="text1">
    <tspan
       id="tspan1">'"${1}°"'</tspan>
  </text>
</svg>' > $TMPDIR/temp.svg
 
}

#info
#infofunc()
cat >  $TMPDIR/info.sh <<_EOF
#!/bin/bash
TMPDIR=/tmp/tempsit
ENCODING="\${LANG#*.}"  #check UTF-8
[ "\$ENCODING" ]&& DEG='°' || DEG=' '
[ -f \$TMPDIR/count ] && TEMP=\$(cat \$TMPDIR/count)
TMP=\$TMPDIR/info
echo "Current CPU temperature is \${TEMP}\${DEG}C" > \$TMP
echo >> \$TMP
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null | grep -q ondemand
if [ \$? -eq 0 ]; then
  echo "OnDemand CPU Scaling: on" >> \$TMP
else
  echo "OnDemand CPU Scaling: off" >> \$TMP
fi	
FREQ=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 2>/dev/null`
if [ -n "\$FREQ" ]; then
  echo >> \$TMP
  echo -n "Current CPU Frequency: " >> \$TMP
  echo -n \${FREQ%???} MHz >> \$TMP
fi

echo -e '<window title="tempsit info">
 <vbox>
  <frame>
   <text><input file>'\$TMP'</input></text>
  </frame>
  <hbox><button ok></button>
  </hbox>
 </vbox>
</window>' > $TMPDIR/infodisplay
_EOF
chmod 755 $TMPDIR/info.sh

case "$1" in
-h|-*help)usagefunc && exit ;;
-v|-*version)echo "${PROG}-${ver}" && exit ;;
-t|-*toggle-startup)
	if [ -h $HOME/Startup/temp2tray ];then rm -f $HOME/Startup/temp2tray
     MSG="removing $HOME/Startup/temp2tray"
      else
     ln -s $0 $HOME/Startup/temp2tray
     MSG="creating startup file $HOME/Startup/temp2tray"
    fi
echo "$MSG" 
exit ;;
infogui)infofunc ;;
esac

[ ! -f $TMPDIR/temp.svg ] && SPID=1

#get cpu temp
cputempfunc(){
while [ ! $SPID = "" ]
	do
	 #echo $SPID #debug
	   FILE=`find /sys/devices/ -name temp1_input|head -n1`
	   OUT1=`cat $FILE`
	   if [ ! $OUT1 ];then
	    FILE=`find /sys/bus/acpi/devices/ -name temp|head -n1`
	    OUT1=`cat $FILE`
	   fi
	   if [ ! $OUT1 ];then echo "not working" && break
	    else OUT=`echo ${OUT1%???}`
	   fi
	   echo ${OUT} > $TMPDIR/count
	 
	 text2svgfunc $OUT &
	 
	 sleep 5 #update at 5 sec intervals
	 SPID=$(pidof sit)
	done
}

cputempfunc &

sleep 1
[ -f $TMPDIR/count ]&& VALUE=`cat $TMPDIR/count`
if [ ! $VALUE ];then 
  
    xmessage -c -bg pink "TEMPSIT ERROR: Your system isn't supported."
    rm -f $HOME/Startup/temp2tray 2>/dev/null && exit
  
fi
#all good, run

THEICON=$TMPDIR/temp.svg
TOOLTIP="tempsit
CPU Temperature

Left click for more info
Right click to quit"
LCLICK="$TMPDIR/info.sh;gtkdialog -f $TMPDIR/infodisplay"
RCLICK="killall sit;rm -r $TMPDIR;"


sit "$THEICON" "$TOOLTIP" "$LCLICK" "$RCLICK"

But of course the function 'infofunc' doesn't work (see edit), have to create a separate script for sit to call.

Playing with this exposed a bug in tempicon so I'll fix that soon, it's in the main loop.

Thanks

EDIT: working now
Puppy Linux Blog - contact me for access

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#48 Post by 01micko »

Version 0.10 is out.

critical bugfix to kill the main loop if you quit the program


See main post

-

There's one Q I will answer
davids45 wrote:A little off-topic maybe, but I'm curious why this interesting little utility was not in Slacko (or is it and I couldn't/can't find it)?
Not off topic at all, the reason is the stability. I wasn't quite happy with it, now I m a little more happy. V 0.06 is currently in the Slacko repo. This version will be taking it's place.

I'm hoping this one will build and run on the raspi platform. Since it is passively cooled temperature stats will be interesting.
Puppy Linux Blog - contact me for access

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#49 Post by 01micko »

version -0.11 is posted

-bugfix

The main loop refused to start after X restart or restarting the prog manually

See main post
Puppy Linux Blog - contact me for access

User avatar
Pete22
Posts: 264
Joined: Fri 08 May 2009, 22:59
Location: Utah, USA

Tempicon working great in Saluki 23 with new Xfce desktop

#50 Post by Pete22 »

01micko

Thank you for a great program.
I wanted you to know that it works well with Saluki 23 that has the latest xfce desktop and panel.

I was wandering. Is there a way to change temp to Fahrenheit?

Pete.

Post Reply