X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/fadc722655b2ba4ebe98eece3498da3c88f8b6fc..bf3a9ba5efb874ad6370a3083afd409361e2912a:/widgets/temp.lua?ds=sidebyside diff --git a/widgets/temp.lua b/widgets/temp.lua index cdf3002..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 temp.widget + return temp end return setmetatable(temp, { __call = function(_, ...) return worker(...) end })