Page 1 of 1

Any way to show CPU temp in Xfce taskbar in 431 NOP? (solved

Posted: Sun 23 Jan 2011, 20:56
by TLM
Is there a way to display the cpu temp in the Xfce taskbar in 431 NOP? I would like it in Fahrenheit if possible. Hard Info shows my sensors Core0 Temp as 42 degrees Celsius. I would like to get that information displayed in my taskbar at all times. Is there a PET anywhere for this? I have found batmon and CPUtemp PETS. I can run CPUtemp from the command line and get an X message about the temperature, however I do not know enough about programming to get the CPU temp into my taskbar. Thank you for any help.

Posted: Sun 23 Jan 2011, 21:23
by TLM
OK, trying to help myself, I have come across this link:

http://goodies.xfce.org/projects/panel- ... mon-plugin

But I do not know how to get or use the sample script shown. However it seems to me that genmon (which NOP 431has) could be used to display the cpu temp. Any ideas? Thanks very much.

Posted: Sun 23 Jan 2011, 21:41
by rjbrewer
Don't know if this works in xfce but it's great in the jwm taskbar
or as a small icon on desktop.

http://murga-linux.com/puppy/viewtopic. ... 94&t=57480

Posted: Mon 24 Jan 2011, 02:29
by TLM
Yes i found that pet, but i cannot use it in Xfce because the directory root/.jwmrc-tray is for jwm desktop, and I cannot find the Xfce counterpart, nor even know if it would work if I could. I am pretty sure that genmon in the Xfce taskbar can be made to show the cpu temp, but I do not know what command to enter when configuring genmon.

Posted: Fri 28 Jan 2011, 21:56
by G0XAN
Genmon is the right solution, but it does need some more work to display what you want.

First off, you need a script to read the temperature and convert it from C to F. This script will do it for you:

Code: Select all

#!/bin/bash

vCpuTemp=$(cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $2}')
vCpuTempUnits=$(cat /proc/acpi/thermal_zone/THRM/temperature | awk '{print $3}')

if echo "$vCpuTempUnits" | grep -q "C"
then
let "vCpuTemp *= 9"
let "vCpuTemp /= 5"
let "vCpuTemp += 32"
fi

echo $vCpuTemp" F"
You might have to change the path in the "cat" commands to get to the temperature sensor in your particular PC. Look around in /proc and you should find it.

Copy & paste the script into a text file and save it somewhere, I use

Code: Select all

/root/my-scripts
and call the script cpuTemp

Then make the script executable. Open a terminal window, go to your script directory and change the script properties:

Code: Select all

cd /root/my-scripts
chmod +x cpuTemp
Now right-click on the genmon panel, i.e. the net or memory monitor on the right of the task-bar and select "Add New Items..."
Scroll down the list to "Generic Monitor", select it and click on "Add"
In the Configuration window, in the Command box type

Code: Select all

/root/my-scripts/cpuTemp
Clear the tick-box next to "Label" and set the "Period (s)" to something suitable (e.g. 10)
Click "Close" and your CPU temperature will appear in Fahrenheit.
All done! :)

If it doesn't work as you expect, you can run the cat command in a terminal window and see what format your temperature is reported in. You might need to adjust the awk commands to suit.

I'm sure someone else could write a neater script, but this one works for me! Hope it helps...

Posted: Fri 28 Jan 2011, 22:06
by rcrsn51
TLM wrote:Yes i found that pet, but i cannot use it in Xfce because the directory root/.jwmrc-tray is for jwm desktop, and I cannot find the Xfce counterpart, nor even know if it would work if I could. I am pretty sure that genmon in the Xfce taskbar can be made to show the cpu temp, but I do not know what command to enter when configuring genmon.
The newest version 1.2 of CPUtemp does not use jwmrc-tray, so it works in 431NOP. Just install the PET and reboot.

Posted: Sun 30 Jan 2011, 03:39
by TLM
GOXAN and rcrsn51, Thank you for your how to. I am running the CPUtemp and it shows my temp when I click on it. GOXAN, i will need some more time to test your scripts, but am looking forward to it. Thanks again.

Posted: Sun 30 Jan 2011, 06:18
by TLM
GOXAN, Your script worked perfectly without any modifications! I have migrated to Puppy from Windows XP and was looking for something to replace CoreTemp I had been using in XP. Your howto solved it. Thanks!

Posted: Mon 31 Jan 2011, 21:01
by G0XAN
Glad to be of help!
If you could now add [solved] to the title of the thread, then one of the moderators can move it to the appropriate category.