On my laptop, I run Crunchbang Linux, due to the fact that it’s a single core Intel CULV processor (read: full size laptop, lightweight, extremely low power consumption with a max TDP of 5.5W, connect to a server to do anything serious). I run Conky¬†as a system monitor. This basic post explains how you can write Python scripts and have them executed by Conky.

For instance, I like to be able to have my CPU temp displayed by Conky. To do so, I use the following incredibly basic Python script.

#! /usr/bin/env python
 
import subprocess
 
cmd = 'grep temp /proc/acpi/thermal_zone/TZ00/temperature'
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 
output = p.stdout.read()
output = output.split(': ')[1].split('\n')[0]
 
print "%s" % output

I should point out that, based on your motherboard sensors and specific OS, your temperature information may be harder to come by.

I saved that Python script as an executable named “tempwatch” in ~/bin (which is in my PATH). Once that was set up, you can edit your ~/.conkyrc file to include the following line

Temperature:$alignr${execi 10 tempwatch}

This tells Conky to reload the temperature information every 10 seconds and display it.

Pretty simply.