diff --git a/lib/awful/widget/layoutbox.lua.in b/lib/awful/widget/layoutbox.lua.in index 5017796a9..88e4be431 100644 --- a/lib/awful/widget/layoutbox.lua.in +++ b/lib/awful/widget/layoutbox.lua.in @@ -8,6 +8,7 @@ local setmetatable = setmetatable local ipairs = ipairs local button = require("awful.button") local layout = require("awful.layout") +local tag = require("awful.tag") local beautiful = require("beautiful") local capi = { image = image, screen = screen, @@ -41,19 +42,9 @@ function new(screen, args) return update(w, tag.screen) end - capi.screen[screen]:add_signal("tag::attach", function(s, tag) - tag:add_signal("property::selected", update_on_tag_selection) - tag:add_signal("property::layout", update_on_tag_selection) - end) - capi.screen[screen]:add_signal("tag::detach", function(s, tag) - tag:remove_signal("property::selected", update_on_tag_selection) - tag:remove_signal("property::layout", update_on_tag_selection) - end) + tag.attached_add_signal(screen, "property::selected", update_on_tag_selection) + tag.attached_add_signal(screen, "property::layout", update_on_tag_selection) - for _, tag in ipairs(capi.screen[screen]:tags()) do - tag:add_signal("property::selected", update_on_tag_selection) - tag:add_signal("property::layout", update_on_tag_selection) - end return w end