tempicon -a tray icon to monitor CPU temp

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

tempicon -a tray icon to monitor CPU temp

#1 Post by 01micko »

tempicon

This app puts a digital CPU temperature monitor in your system tray (taskbar).. screen shot attached.

NEW: dependency on lm_sensors is now optional (ymmv)

Also note that lm_sensors and different HW sensors give completely different output, even from version to version and kernel to kernel making the older method I used to find the temperature a joke! The way it's done now is more reliable. Works on all my machines that have sensors, including the raspberry pi (latest kernel with raspbian installed). Also works in KDE with Slackware-current.


Now version 0.21

Changelog:
v-0.21 131121
-rewrite of the C source to be more multiuser friendly
-temp files now in ~/tempicon
-made icons square, work-around for bug in JWM-r876 (pemasu)
-removed unecessary code

v-0.19 130404
-added support for gtk+-3.0 (only available at compile time, see the README in the source)
-added a configure script, deleted hard code Makefile
-bugfix - in kernels >=3.7 the script was finding the GPU, not CPU temp

v-0.18 130320 (unreleased in general)
- moved main script to a functions library script

v-0.17 130301
- improvements to scripts
- better efficiency
- fixed a bug where blank lines were appended to /tmp/xerrs.log

v-0.16 130131
-rewritten to call the script from the binary, not binary from script
- this reduces CPU load and gets rid of a bash loop.

v-0.15 130102
-fixes for slackbones

v-0.14 121020
-font fixes again

v-0.13 120920
-font fixes for different arches (hoping it builds on raspberry pi ... it does!)
-added extra colour and changed colour grading
-added icons to right click menu

v-0.12 120902 (not released)
-bugfix -newer lm_sensors have slightly different format, rely on manual method
to get the cpu temp displayed by icon
-fixed calls from 'sh' to 'bash'
-fixed calls to to gtkdialog (not gtkdialog3 or gtkdialog4)

v-0.11 120702
-bugfix -mainloop refused to start after X restart
-removed "Help" button if lm_sensors is not installed

v-0.10 120701
-bugfix -kill main loop on quitting
-ensure $PREFIX/tempicongui is charset UTF-8 for degree symbol
-improvements to makefile, new2dir compatible, default PREFIX=/usr/local
hack the Makefile for different PREFIX

v-0.09 120610
-add support for Makefile
-small bugfixes in C code
-rounded corners of the icons
-no longer generating icons, done at compile stage

v-0.08 120601 (unpublished)
-remove lm_sensors as needed dependency
-support Fatdog
-changed installation
-added README

v-0.07
-remove startup script automatically when you get the pink error message

v-0.06 120121
-fixed version (CatDude)
-added menuitem in tempiconsvg.c to remove from Startup (mainly for woof builds to give user some control over the tray)
-fixed pinstall.sh, bad link (woof install)
-fixed typo MUDULE :lol:

v-0.05 120120
-rewrote for svg (source now tempiconsvg.c) .. looks nicer, and is more hackable, eg you could change the font if you like, not supported though
-added temps up to 105 C
-removed "C" from icon.. I am NOT suporting "F".. get with the program US!
-icons now created in pinstall.sh, it's plenty fast enough
-removed text2xpm depend

v-0.04 120110
-bugfix with loading module logic and fix typo (DaveS)

v-0.03 120101
-added module detection and module loading capability to tempicon.sh
-module printed to /etc/tempicon.conf, removed on uninstall
-adjusted puninstall.sh
-added "usage" to tempicon.sh
-added sensors check to tempicon.sh
-changed CPUtemp and CPUtemp.hlp to tempicongui and tempicon.hlp
wont clobber rcrsn51's app
-filter out degree symbol in gui for non UTF-8 enabled encoding
-changed to mono font in tempicongui
-changed text in tempicon.hlp to use tempicon.sh -m to load module
-changed tempicon.c to call tempicongui instead of CPUtemp
-added toggle to add/remove Startup file "tempicon.sh -t"

v-0.02 111230
-hacked text2xpm font. "~" (tilde) is now "°" (degree)
-adjusted tempicon.sh to draw degree sympal to *.xpm's
-tempicon.sh now get's the highest temp value and makes gross
assumption that that is CPU temp, usually is.
-tempicon.c, adjusted comment with old scriptname, "text-temp" to "tempicon.sh"
-removed lm-sensors binaries to separate package, added warning to pinstall.sh

v-0.01 111229
-initial release
NOTE: lm_sensors is now a separate package as there are newer versions available. You CAN IF YOU LIKE (was 'must', ymmv) install lm_sensors, either the one posted below or from PPM. You should do this before installing tempicon-0.xx.pet. If you have previous version of tempicon installed please uninstall with PPM first to cleanup the old files (taken care of in the puninstall.sh).

DEBUG: If the app fails for you, to supply debug info, run sensors in a terminal and post the output. Thanks.

_________________________________________________________________________

This is an app I have been working on. It displays your cpu temperature in the tray, a handy feature when your machine is under heavy load in warm conditions, eg: compiling large progs in the Queensland summer.

It OPTIONALLY depends on lm_sensors (included) and it also includes rcrsn51's gtkdialog gui from CPUtemp to display more information, mobo temp, fanspeed etc. Thanks rcrsn51. Activate that gui by right clicking the icon and clicking the "more info" tab.

It does not include any images. They are generated by technosaurus' nifty little script text2xpm (the colour and size supported version). So, it depends on text2xpm too(OLD INFO, now uses svg), included.

//@techno, can you add a degree symbol? I tried .. but.. :oops: [solved]

----

It works by running a script to save temperature to a temporary file, updated every five seconds, then a little C gtkstatusicon proggy reads that info and displays the cpu temp.

The exec is compiled on Slacko so if it fails for you, perhaps due to an older gtk+-2.0 version, the sources and a compile script are provided. (devx is needed to compile)

This is only my second ever proggy written in C, so this must be considered alpha quality software. (The other is an OLPC battery monitor, only runs on OLPC xo-1 and xo-1.5 hardware).

Usual cautions apply.

When you install there is an option to add a Startup file to start it when X starts.

Any C coders please offer your critique, same goes for the bash bits.

Have fun!
Attachments
tempiconsvg-0.21-i486.pet
latest 32 bit bin RE-UPLOADED after 2 downloads, bug in functions script
(10.83 KiB) Downloaded 5604 times
tempiconsvg-0.21.tar.gz
source
(9.51 KiB) Downloaded 956 times
Screenshot_2013-11-21.png
(16.67 KiB) Downloaded 19329 times
tempiconsvg-0.19-i486.pet
(10.72 KiB) Downloaded 1621 times
tempiconsvg-0.19.tar.bz2
sauce code.. supports gtk3 and configure script now
(9.14 KiB) Downloaded 710 times
tempiconsvg-0.17-i486.pet
32 bit only.. more tomorrow.
(10.65 KiB) Downloaded 1029 times
tempiconsvg-0.16-x86_64.pet
64 bit only! Suits FatDog, LHP-64, Slackbones (slackbones users must unpack manually)
(11.79 KiB) Downloaded 1100 times
tempiconsvg-0.16-i486.pet
pet compiled in Slacko, 32 bit, suit most pups
(11.23 KiB) Downloaded 1091 times
tempiconsvg-0.16.tar.bz2
SOURCE code
(7.98 KiB) Downloaded 772 times
lm_sensors-3.1.2.pet
THIS WAS REQUIRED or use one you compile or one from PPM (Slacko has it, I expect dpup and lupu too), you may not need it now
(72.05 KiB) Downloaded 2030 times
Last edited by 01micko on Thu 21 Nov 2013, 10:50, edited 26 times in total.
Puppy Linux Blog - contact me for access

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#2 Post by jemimah »

I've been thinking working on traytemp too but I'm having difficultly figuring out which temperature to display. Here is the output I get from sensors on my new laptop.

Code: Select all

# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +0.0 C  (crit = +127.0 C)                  
temp2:        +0.0 C  (crit = +127.0 C)                  
temp3:       +11.0 C  (crit = +128.0 C)                  
temp4:       +35.0 C  (crit = +127.0 C)                  
temp5:        +0.0 C  (crit = +115.0 C)                  
temp6:       +20.0 C  (crit = +128.0 C)                  
temp7:        +0.0 C  (crit = +128.0 C)                  
temp8:       +38.0 C  (crit = +128.0 C)                  
temp9:       +46.0 C  (crit = +128.0 C)                  
temp10:      +59.0 C  (crit = +128.0 C)
Do you think there is an algorithmic way to make sense of something like this? Monitor the temp that is closest to critical? Average the values? What do you think?

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

#3 Post by 01micko »

jemimah wrote:I've been thinking working on traytemp too but I'm having difficultly figuring out which temperature to display. Here is the output I get from sensors on my new laptop.

Code: Select all

# sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +0.0 C  (crit = +127.0 C)                  
temp2:        +0.0 C  (crit = +127.0 C)                  
temp3:       +11.0 C  (crit = +128.0 C)                  
temp4:       +35.0 C  (crit = +127.0 C)                  
temp5:        +0.0 C  (crit = +115.0 C)                  
temp6:       +20.0 C  (crit = +128.0 C)                  
temp7:        +0.0 C  (crit = +128.0 C)                  
temp8:       +38.0 C  (crit = +128.0 C)                  
temp9:       +46.0 C  (crit = +128.0 C)                  
temp10:      +59.0 C  (crit = +128.0 C)
Do you think there is an algorithmic way to make sense of something like this? Monitor the temp that is closest to critical? Average the values? What do you think?
Well, that output will certainly bork my tempicon.sh script! On my old laptop I get similar output but the order is reversed. I made the gross assumption in my case that, more less the hottest is the temp of the CPU, which is temp1 for me. Nothing algorithmic about that!

Thanks for your sensors output. At least I can cover your case but I am sure there will be others. I've only covered my Athlon and my old Intel, so the script has a way to go yet.
Puppy Linux Blog - contact me for access

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

#4 Post by DaveS »

Installed on my lappy but it just displayed 10 deg :) Actual temp is around 56 deg. Uninstalling broke CPU Temp of course, which I had to re-install after.
Spup Frugal HD and USB
Root forever!

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

#5 Post by 01micko »

Dave,

In the first post I'll have to request some debugging output on failure. Run sensors in a terminal. I should be able to make a case based on the module used. On todo list.
Puppy Linux Blog - contact me for access

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

#6 Post by technosaurus »

Which of the supported characters can you live without?
You can use that and modify its font representation to resemble a superscript 'o'
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:

#7 Post by 01micko »

techno

Yeah thought about that, I think the tilde ~... or any non numeric char except C. Did try the tilde but I goofed by changing the tilde to degree in the array. So I'll leave the tilde in the array and just alter the font. TY.
Puppy Linux Blog - contact me for access

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

#8 Post by 01micko »

Ver 0.02 is posted,

see main post

-

jemimah and DaveS.

I am finding the values differently now so hopefully tempicon-0.02 should work for you. One thing I may have to address is cold weather conditions. Your machine may be below 10 C and I haven't covered that. There is code built in to the exec that's prints to stderr if an icon isn't found so the app should recover when the machine warms up. Likely 10 C will be shown until then.

I am using the gross assumption that the highest temp is the CPU temp. It is on my Athlon because CPU temp is labeled:

Code: Select all

# sensors
atk0110-acpi-0
Adapter: ACPI interface
Vcore Voltage:     +1.43 V  (min =  +0.85 V, max =  +1.60 V)
 +3.3 Voltage:     +3.16 V  (min =  +2.97 V, max =  +3.63 V)
 +5 Voltage:       +4.93 V  (min =  +4.50 V, max =  +5.50 V)
 +12 Voltage:     +11.63 V  (min = +10.20 V, max = +13.80 V)
CPU FAN Speed:    2896 RPM  (min =  600 RPM)
CHASSIS FAN Speed:   0 RPM  (min =  600 RPM)
CPU Temperature:   +66.0°C  (high = +60.0°C, crit = +95.0°C)  
MB Temperature:    +35.0°C  (high = +45.0°C, crit = +75.0°C)  

k10temp-pci-00c3
Adapter: PCI adapter
temp1:       +66.6°C  (high = +70.0°C, crit = +99.5°C)
This is the code I am using to get the value:

Code: Select all

sensors|grep \+|cut -d '+' -f2|cut -d '.' -f1|sort -n|tail -n1
On my machine I timed that code at less than 0.01 of a second, plenty fast enough. I read that temperature is only polled once or twice a second.

Have fun!
Puppy Linux Blog - contact me for access

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

#9 Post by DaveS »

0.02 is working :) Even has a degree sign!
Spup Frugal HD and USB
Root forever!

Samus2012
Posts: 1
Joined: Fri 30 Dec 2011, 17:15

Re: tempicon -a tray icon to monitor CPU temp

#10 Post by Samus2012 »

Nice! Just downloaded and installed the .PET files and it works great on my AMD 64 3500+ system and is showing "41C".

The info also shows:

CPU FAN Speed: 3375 RPM (min = 800 RPM)
CHASSIS FAN Speed: 2070 RPM (min = 1200 RPM)

With Puppy Linux 5.3.1 (and even 4.1.2) the fans are always maxed out. But, when I let the system boot into Windows XP, the fans throttle back once the Windows login is displayed and only speed up when necessary.

Is there anything I can do to regulate fan speed based on the CPU/MB temps?

Thanks.

Ken

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

#11 Post by 01micko »

01micko wrote:One thing I may have to address is cold weather conditions. Your machine may be below 10 C and I haven't covered that. There is code built in to the exec that's prints to stderr if an icon isn't found so the app should recover when the machine warms up. Likely 10 C will be shown until then.
Dave.. from a cold start is this ever a problem? I wont be able to test that for at least 6 months! (er, unless I shove my lappy in the freezer!).
Samus2012 wrote:Is there anything I can do to regulate fan speed based on the CPU/MB temps?
First of all, welcome to the kennels!

Probably, but it would have to be a script based on current fan speed/temperature and telling the module which controls fan speed to slow down/speed up depending on those results. Maybe you could post in the software>requests forum? More eyes would see it then :wink:
Puppy Linux Blog - contact me for access

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

#12 Post by DaveS »

Strange thing.... after re-boot, it just displays 10 deg. If I then right click and select 'more info' the dialogue pops up displaying the temp as it should, then a few seconds later, the tray icon begins giving the correct reading. It is then fine till next boot, whereupon I have to repeat the process.
Will try a sub 10 deg start in the morning :)
Spup Frugal HD and USB
Root forever!

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

#13 Post by 01micko »

DaveS wrote:Strange thing.... after re-boot, it just displays 10 deg. If I then right click and select 'more info' the dialogue pops up displaying the temp as it should, then a few seconds later, the tray icon begins giving the correct reading. It is then fine till next boot, whereupon I have to repeat the process.
Will try a sub 10 deg start in the morning :)
Ok, that's weird. If you can reproduce this, before you click anything run

Code: Select all

cat /tmp/tempicon/count
I suspect you may get "no such file or dirctory" in which case the tempicon.sh script is falling down somewhere. If you get the correct reading then the exec is failing.
Puppy Linux Blog - contact me for access

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

#14 Post by DaveS »

OK, ran the command... terminal gave zero output, jut a return to the prompt.
Spup Frugal HD and USB
Root forever!

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

#15 Post by 01micko »

DaveS wrote:OK, ran the command... terminal gave zero output, jut a return to the prompt.
Ah, so I bet there was an empty line, meaning the script is failing.
I have a bug in lm_sensors where I can't suppress stdout and consequently my xerrs.log fills up.
I bet for you, "sensors" is failing to run, that's why it's ok after you right click and look at the gui. Thanks Dave, I think I can fix it.

EDIT: Hmmmm... I bet coretemp module is not loaded. rcrsn51's script loads it, then you are ok.
So, when you startup and it fails run modprobe coretemp and see if that fixes it. I'll wait til I hear from you then make a 0.03 version if that is the fix. (likely IMO)
Puppy Linux Blog - contact me for access

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

#16 Post by DaveS »

Yup... modprobe coretemp activates it :)
Spup Frugal HD and USB
Root forever!

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#17 Post by sc0ttman »

Just a quick question, don't waste any serious thought on it, but is 2.6.25.16 likely to be missing coretemp.ko?? Cos I get this:

Code: Select all

# modprobe coretemp
FATAL: Error inserting coretemp (/lib/modules/2.6.25.16/kernel/drivers/hwmon/coretemp.ko): No such device
Attachments
screen.png
(37.73 KiB) Downloaded 1256 times
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

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

#18 Post by 01micko »

sc0ttman wrote:Just a quick question, don't waste any serious thought on it, but is 2.6.25.16 likely to be missing coretemp.ko?? Cos I get this:

Code: Select all

# modprobe coretemp
FATAL: Error inserting coretemp (/lib/modules/2.6.25.16/kernel/drivers/hwmon/coretemp.ko): No such device
Nah, the module is there, study your output :wink: . It's just your board doesn't use coretemp. What board/chip you got? Anyway, you can find your module with "sensors-detect".

I am trying to implement an automagic solution so the user needn't bother loading modules, but it's tricky. Should be ok though.
Puppy Linux Blog - contact me for access

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

#19 Post by 01micko »

v 0.03 is out

see main post

Should load some modules automatically now
Puppy Linux Blog - contact me for access

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

#20 Post by DaveS »

01micko wrote:v 0.03 is out

see main post

Should load some modules automatically now
Happy New Year Mick. OK, .03 is not so good. Every boot, it flashes up the 'run sensors-detect' dialogue and the tray icon does not display. I go through the detection process, and at the end dismiss the terminal and dialogue, but the tray icon does not appear till I re-start X. I have to do this full process at each boot.
Spup Frugal HD and USB
Root forever!

Post Reply