mirror of https://github.com/lcpz/lain.git
#141 make battery table local to worker
This commit is contained in:
parent
c886c5497d
commit
29983d95b2
|
@ -21,9 +21,9 @@ local setmetatable = setmetatable
|
||||||
|
|
||||||
-- Battery infos
|
-- Battery infos
|
||||||
-- lain.widgets.bat
|
-- lain.widgets.bat
|
||||||
local bat = {}
|
|
||||||
|
|
||||||
local function worker(args)
|
local function worker(args)
|
||||||
|
local bat = {}
|
||||||
local args = args or {}
|
local args = args or {}
|
||||||
local timeout = args.timeout or 30
|
local timeout = args.timeout or 30
|
||||||
local battery = args.battery or "BAT0"
|
local battery = args.battery or "BAT0"
|
||||||
|
@ -143,7 +143,7 @@ local function worker(args)
|
||||||
|
|
||||||
newtimer(battery, timeout, update)
|
newtimer(battery, timeout, update)
|
||||||
|
|
||||||
return bat.widget
|
return setmetatable(bat, { __index = bat.widget })
|
||||||
end
|
end
|
||||||
|
|
||||||
return setmetatable(bat, { __call = function(_, ...) return worker(...) end })
|
return setmetatable({}, { __call = function(_, ...) return worker(...) end })
|
||||||
|
|
Loading…
Reference in New Issue