add fanspeed widget
This commit is contained in:
parent
602eada652
commit
012b67a8c0
|
@ -0,0 +1,28 @@
|
|||
-- {{{ Grab environment
|
||||
local setmetatable = setmetatable
|
||||
local helpers = require("vicious.helpers")
|
||||
local tonumber = tonumber
|
||||
-- }}}
|
||||
|
||||
|
||||
-- fanspeed: provides speed level of main fan
|
||||
--
|
||||
-- expects one (1) full sysctl string to entry
|
||||
-- e.g.: "dev.acpi_ibm.0.fan_speed"
|
||||
|
||||
local fanspeed_freebsd = {}
|
||||
|
||||
local function worker(format, warg)
|
||||
if not warg then return end
|
||||
|
||||
local fanspeed = helpers.sysctl(warg)
|
||||
|
||||
if not fanspeed then
|
||||
-- use negative fanspeed to indicate error
|
||||
return {-1}
|
||||
else
|
||||
return {tonumber(fanspeed)}
|
||||
end
|
||||
end
|
||||
|
||||
return setmetatable(fanspeed_freebsd, { __call = function(_, ...) return worker(...) end })
|
Loading…
Reference in New Issue