From fde31037b9f20413d150b4293597215e21ccd5eb Mon Sep 17 00:00:00 2001 From: Andreas Geisenhainer Date: Sun, 8 Jan 2017 12:56:14 +0100 Subject: [PATCH] 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 --- widgets/thermal_freebsd.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/widgets/thermal_freebsd.lua b/widgets/thermal_freebsd.lua index 718fc1f..ea688fb 100644 --- a/widgets/thermal_freebsd.lua +++ b/widgets/thermal_freebsd.lua @@ -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 -- }}}