aboutsummaryrefslogtreecommitdiff
path: root/thermal.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2010-03-14 01:55:33 +0100
committerAdrian C. (anrxc) <anrxc@sysphere.org>2010-03-14 01:55:33 +0100
commit237470c8f45190b213e3a173ce6ae1a74b3e11fe (patch)
tree7f53c8144761947d4bde20715bcad34f4be0d6c0 /thermal.lua
parent9a82d4113a8271b7dfc7506f2b07379e3ede89a8 (diff)
downloadvicious-legacy-237470c8f45190b213e3a173ce6ae1a74b3e11fe.tar.xz
API: transform widgets namespace table to a directory
Diffstat (limited to 'thermal.lua')
-rw-r--r--thermal.lua42
1 files changed, 0 insertions, 42 deletions
diff --git a/thermal.lua b/thermal.lua
deleted file mode 100644
index d7e98fc..0000000
--- a/thermal.lua
+++ /dev/null
@@ -1,42 +0,0 @@
----------------------------------------------------
--- Licensed under the GNU General Public License v2
--- * (c) 2010, Adrian C. <anrxc@sysphere.org>
----------------------------------------------------
-
--- {{{ Grab environment
-local type = type
-local tonumber = tonumber
-local setmetatable = setmetatable
-local string = { match = string.match }
-local helpers = require("vicious.helpers")
--- }}}
-
-
--- Thermal: provides temperature levels of ACPI and coretemp thermal zones
-module("vicious.thermal")
-
-
--- {{{ Thermal widget type
-local function worker(format, warg)
- local zone = { -- Known temperature data sources
- ["sys"] = {"/sys/class/thermal/", file = "temp", div = 1000},
- ["core"] = {"/sys/devices/platform/", file = "temp1_input",div = 1000},
- ["proc"] = {"/proc/acpi/thermal_zone/",file = "temperature"}
- } -- Default to /sys/class/thermal
- local warg = type(warg) == "table" and warg or {warg, "sys"}
- local thermal = helpers.pathtotable(zone[warg[2]][1] .. warg[1])
-
- -- Get temperature from thermal zone
- if thermal[zone[warg[2]].file] then
- if zone[warg[2]].div then
- return {thermal[zone[warg[2]].file] / zone[warg[2]].div}
- else -- /proc/acpi "temperature: N C"
- return {tonumber(string.match(thermal[zone[warg[2]].file], "[%d]+"))}
- end
- end
-
- return {0}
-end
--- }}}
-
-setmetatable(_M, { __call = function(_, ...) return worker(...) end })