X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/d9877c4bedca550478507f268f43e137e4454c24..49a4df385e953156e6d1e2ee0bcfd07d8501d0f4:/widgets/temp.lua?ds=inline diff --git a/widgets/temp.lua b/widgets/temp.lua index e769b25..4d8a727 100644 --- a/widgets/temp.lua +++ b/widgets/temp.lua @@ -6,7 +6,7 @@ --]] -local newtimer = require("lain.helpers").newtimer +local helpers = require("lain.helpers") local wibox = require("wibox") local io = { open = io.open } local tonumber = tonumber @@ -14,7 +14,7 @@ local setmetatable = setmetatable -- coretemp -- lain.widgets.temp -local temp = {} +local temp = helpers.make_widget_textbox() local function worker(args) local args = args or {} @@ -22,8 +22,6 @@ local function worker(args) local tempfile = args.tempfile or "/sys/class/thermal/thermal_zone0/temp" local settings = args.settings or function() end - temp.widget = wibox.widget.textbox() - function update() local f = io.open(tempfile) if f then @@ -37,9 +35,9 @@ local function worker(args) settings() end - newtimer("coretemp", timeout, update) + helpers.newtimer("coretemp", timeout, update) - return setmetatable(temp, { __index = temp.widget }) + return temp end return setmetatable(temp, { __call = function(_, ...) return worker(...) end })