From 9c9b2b52b007860677bcd38f141efa0570bef021 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 20 Oct 2012 17:35:09 +0200 Subject: [PATCH] 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 --- lib/awful/tag.lua.in | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 8081c930..98ccd4d5 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -479,15 +479,11 @@ function tag.withcurrent(c, startup) end local function attached_connect_signal_screen(screen, sig, func) - capi.screen[screen]:connect_signal("tag::attach", function (s, _tag) - _tag:connect_signal(sig, func) + capi.tag.connect_signal(sig, function(_tag, ...) + if tag.getscreen(_tag) == screen then + func(_tag) + 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 --- 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 attached_connect_signal_screen(screen, ...) else - for screen = 1, capi.screen.count() do - attached_connect_signal_screen(screen, ...) - end + capi.tag.connect_signal(...) end end