X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/ce12475edea7c76fea7f7e020d83d340aa8f1d7c..87b323bd06e0d7e4f6e4eca3dee9990d3662b7c5:/widgets/bat.lua?ds=sidebyside diff --git a/widgets/bat.lua b/widgets/bat.lua index f63b1fa..8e483f7 100644 --- a/widgets/bat.lua +++ b/widgets/bat.lua @@ -7,7 +7,7 @@ --]] -local newtimer = require("lain.helpers").newtimer +local helpers = require("lain.helpers") local first_line = require("lain.helpers").first_line local naughty = require("naughty") @@ -27,7 +27,7 @@ local setmetatable = setmetatable -- lain.widgets.bat local function worker(args) - local bat = {} + local bat = helpers.make_widget_textbox() local args = args or {} local timeout = args.timeout or 30 local batteries = args.batteries or (args.battery and {args.battery}) or {"BAT0"} @@ -35,8 +35,6 @@ local function worker(args) local notify = args.notify or "on" local settings = args.settings or function() end - bat.widget = wibox.widget.textbox('') - bat_notification_low_preset = { title = "Battery low", text = "Plug the cable!", @@ -165,9 +163,9 @@ local function worker(args) end end - newtimer(battery, timeout, bat.update) + helpers.newtimer(battery, timeout, bat.update) - return setmetatable(bat, { __index = bat.widget }) + return bat end return setmetatable({}, { __call = function(_, ...) return worker(...) end })