You are not logged in.

#1 2013-08-20 04:44:16

z1lt0id
Member
Registered: 2012-09-20
Posts: 177

[awesome wm] K10temp and temperature widget

Just wondering how I would go about incorporating the k10temp module temperature in an awesome widget.

If I type for example:

sensors | grep temp1

I get the following information

temp1:         +6.4°C  (high = +70.0°C)
temp1:        +24.0°C  (low  = +79.0°C, high = +65.0°C)  sensor = thermisto

The first temp1 is the core and the next one is my socket temperature.  The reason for the low temp is due to a closed water cooling loop.

How would I incorporate this information into a widget in Awesome?

A simple temperature widget is the following:

-- {{{ CPU temperature
local thermalwidget  = widget({ type = "textbox" })
vicious.register(thermalwidget, vicious.widgets.thermal, " - $1°C", 20, { "coretemp.0", "core"} )
-- }}}

But as you can see coretemp.0 is for Intel chips and not for AMD. 
The file with the temp information is located at

/sys/module/k10temp/drivers/pci:k10temp/0000:00:18.3/temp1_input

How would I apply this?

Offline

#2 2013-08-20 14:10:22

sardina
Member
Registered: 2013-02-23
Posts: 152

Re: [awesome wm] K10temp and temperature widget

You could do it with io.popen and string.gsub, which are lua functions, and with timer and signals from Awesome library.

This is how you get the output in a string:

local f = io.popen("sensors | grep temp1")
local output = f:read("*all")
f:close()

then you can process the string with string.gsub, there's plenty of docs online about how to.

Assuming you write all of this in a function which sets your widget, now you just need to define a timer, which periodically waits t_out seconds and calls function, connect a timeout signal on and start it:

local mytimer = timer({ timeout = t_out })
mytimer:connect_signal("timeout", function)
mytimer:start()

EDIT: You can check my repos for some examples.

Last edited by sardina (2013-08-20 14:12:35)

Offline

Board footer

Powered by FluxBB