move thermal widget to match new layout
This commit is contained in:
parent
5c7c695ea1
commit
22d49a9e5d
|
@ -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 })
|
|
@ -15,7 +15,7 @@ local math = { floor = math.floor }
|
||||||
|
|
||||||
-- Thermal: provides temperature levels of ACPI and coretemp thermal zones
|
-- Thermal: provides temperature levels of ACPI and coretemp thermal zones
|
||||||
-- vicious.widgets.thermal
|
-- vicious.widgets.thermal
|
||||||
local thermal = {}
|
local thermal_linux = {}
|
||||||
|
|
||||||
|
|
||||||
-- {{{ Thermal widget type
|
-- {{{ Thermal widget type
|
||||||
|
@ -46,4 +46,4 @@ local function worker(format, warg)
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
return setmetatable(thermal, { __call = function(_, ...) return worker(...) end })
|
return setmetatable(thermal_linux, { __call = function(_, ...) return worker(...) end })
|
Loading…
Reference in New Issue