X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/1afe5367af3f643144ba7cdc1d6e289ec9b9b096..2d35d4e102074ae449ec1f4d261517fe06c5a01d:/widgets/temp.lua?ds=sidebyside diff --git a/widgets/temp.lua b/widgets/temp.lua index a4ada52..4d8a727 100644 --- a/widgets/temp.lua +++ b/widgets/temp.lua @@ -6,18 +6,15 @@ --]] -local newtimer = require("lain.helpers").newtimer - +local helpers = require("lain.helpers") local wibox = require("wibox") - local io = { open = io.open } local tonumber = tonumber - local setmetatable = setmetatable -- coretemp -- lain.widgets.temp -local temp = {} +local temp = helpers.make_widget_textbox() local function worker(args) local args = args or {} @@ -25,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 @@ -40,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 })