expands thermal_freebsd wigdet to handle multiple values

* takes a table of strings
 * returns a table of values (one value for each entry)

Signed-off-by: Andreas Geisenhainer <psycorama@datenhalde.de>
This commit is contained in:
Andreas Geisenhainer 2017-01-08 12:56:14 +01:00
parent 3ce5994e61
commit fde31037b9
1 changed files with 11 additions and 6 deletions

View File

@ -13,14 +13,19 @@ local thermal_freebsd = {}
-- {{{ Thermal widget type
local function worker(format, warg)
if not warg then return end
local thermals = {}
local cnt = 1
while cnt <= #warg do
local output = helpers.sysctl( "" .. warg[cnt] .. "" )
local temp = helpers.sysctl("hw.acpi.thermal.tz" .. warg .. ".temperature")
if not temp then
return {0}
else
return {string.match(temp, "[%d]+%.[%d]+")}
if not output then
thermals[cnt] = 0
else
thermals[cnt] = tonumber( string.match(output, "[%d][%d]") )
end
cnt = cnt + 1
end
return thermals
end
-- }}}