vicious/thermal.lua

30 lines
751 B
Lua
Raw Normal View History

2009-09-29 22:33:19 +02:00
---------------------------------------------------
-- Licensed under the GNU General Public License v2
2010-01-02 21:21:54 +01:00
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
2009-09-29 22:33:19 +02:00
---------------------------------------------------
-- {{{ Grab environment
local setmetatable = setmetatable
local helpers = require("vicious.helpers")
-- }}}
-- Thermal: provides temperature levels of ACPI thermal zones
module("vicious.thermal")
-- {{{ Thermal widget type
2009-08-07 17:41:10 +02:00
local function worker(format, thermal_zone)
local thermal = helpers.pathtotable("/sys/class/thermal/"..thermal_zone)
-- Get ACPI thermal zone
if thermal.temp then
return {thermal.temp / 1000}
end
return {0}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })