move thermal widget to match new layout

This commit is contained in:
mutlusun 2017-01-25 17:55:23 +01:00 committed by Jörg Thalheim
parent 5c7c695ea1
commit 22d49a9e5d
No known key found for this signature in database
GPG Key ID: CA4106B8D7CC79FA
2 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,34 @@
-- {{{ Grab environment
local setmetatable = setmetatable
local string = { match = string.match }
local helpers = require("vicious.helpers")
-- }}}
-- Thermal: provides temperature levels of ACPI and coretemp thermal zones
-- vicious.widgets.thermal
local thermal_freebsd = {}
-- {{{ Thermal widget type
local function worker(format, warg)
if not warg then return end
if type(warg) ~= "table" then warg = { warg } end
local thermals = {}
for i=1, #warg do
local output = helpers.sysctl(warg[i])
if not output then
thermals[i] = -1
else
thermals[i] = string.match(output, "[%d]+")
end
end
return thermals
end
-- }}}
return setmetatable(thermal_freebsd, { __call = function(_, ...) return worker(...) end })

View File

@ -15,7 +15,7 @@ local math = { floor = math.floor }
-- Thermal: provides temperature levels of ACPI and coretemp thermal zones
-- vicious.widgets.thermal
local thermal = {}
local thermal_linux = {}
-- {{{ Thermal widget type
@ -46,4 +46,4 @@ local function worker(format, warg)
end
-- }}}
return setmetatable(thermal, { __call = function(_, ...) return worker(...) end })
return setmetatable(thermal_linux, { __call = function(_, ...) return worker(...) end })