awful.tag.attached_connect_signal: Simplify
Signals are emitted on individual objects and on the class for a while now. This can be used to simplify this function a lot. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
2ada67b730
commit
9c9b2b52b0
|
@ -479,15 +479,11 @@ function tag.withcurrent(c, startup)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function attached_connect_signal_screen(screen, sig, func)
|
local function attached_connect_signal_screen(screen, sig, func)
|
||||||
capi.screen[screen]:connect_signal("tag::attach", function (s, _tag)
|
capi.tag.connect_signal(sig, function(_tag, ...)
|
||||||
_tag:connect_signal(sig, func)
|
if tag.getscreen(_tag) == screen then
|
||||||
|
func(_tag)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
capi.screen[screen]:connect_signal("tag::detach", function (s, _tag)
|
|
||||||
_tag:disconnect_signal(sig, func)
|
|
||||||
end)
|
|
||||||
for _, _tag in ipairs(tag.gettags(screen)) do
|
|
||||||
_tag:connect_signal(sig, func)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a signal to all attached tag and all tag that will be attached in the
|
--- Add a signal to all attached tag and all tag that will be attached in the
|
||||||
|
@ -497,9 +493,7 @@ function tag.attached_connect_signal(screen, ...)
|
||||||
if screen then
|
if screen then
|
||||||
attached_connect_signal_screen(screen, ...)
|
attached_connect_signal_screen(screen, ...)
|
||||||
else
|
else
|
||||||
for screen = 1, capi.screen.count() do
|
capi.tag.connect_signal(...)
|
||||||
attached_connect_signal_screen(screen, ...)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue