systray: Turn this into a singleton

There's no point in having multiple instances of this, because there are no
per-instance settings and the systray can only be visible in a single place at a
time anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-03-05 16:17:35 +01:00
parent ab408103ee
commit ea95963726
1 changed files with 5 additions and 1 deletions

View File

@ -90,8 +90,12 @@ local function new(revers)
return ret return ret
end end
local instance
function systray.mt:__call(...) function systray.mt:__call(...)
return new(...) if not instance then
instance = new(...)
end
return instance
end end
return setmetatable(systray, systray.mt) return setmetatable(systray, systray.mt)