3 Licensed under GNU General Public License v2
8 local helpers = require("lain.helpers")
9 local wibox = require("wibox")
10 local tonumber = tonumber
12 -- {thermal,core} temperature info
15 local function factory(args)
16 local temp = { widget = wibox.widget.textbox() }
17 local args = args or {}
18 local timeout = args.timeout or 30
19 local tempfile = args.tempfile or "/sys/devices/virtual/thermal/thermal_zone0/temp"
20 local settings = args.settings or function() end
22 function temp.update()
23 helpers.async({"find", "/sys/devices", "-type", "f", "-name", "*temp*"}, function(f)
25 local temp_fl, temp_value
26 for t in f:gmatch("[^\n]+") do
27 temp_fl = helpers.first_line(t)
29 temp_value = tonumber(temp_fl)
30 temp_now[t] = temp_value and temp_value/1e3 or temp_fl
33 coretemp_now = temp_now[tempfile] or "N/A"
39 helpers.newtimer("thermal", timeout, temp.update)