diff --git a/ewmh.c b/ewmh.c index fa548dd2b..817957db2 100644 --- a/ewmh.c +++ b/ewmh.c @@ -366,18 +366,19 @@ ewmh_process_desktop(client_t *c, uint32_t desktop) if(desktop == 0xffffffff) { luaA_object_push(globalconf.L, c); - client_set_sticky(globalconf.L, -1, true); + lua_pushnil(globalconf.L); + luaA_object_emit_signal(globalconf.L, -2, "request::tag", 1); + /* Pop the client, arguments are already popped */ lua_pop(globalconf.L, 1); } else if (idx >= 0 && idx < globalconf.tags.len) - for(int i = 0; i < globalconf.tags.len; i++) - if(idx == i) - { - luaA_object_push(globalconf.L, globalconf.tags.tab[i]); - tag_client(c); - } - else - untag_client(c, globalconf.tags.tab[i]); + { + luaA_object_push(globalconf.L, c); + luaA_object_push(globalconf.L, globalconf.tags.tab[idx]); + luaA_object_emit_signal(globalconf.L, -2, "request::tag", 1); + /* Pop the client, arguments are already popped */ + lua_pop(globalconf.L, 1); + } } int diff --git a/lib/awful/ewmh.lua.in b/lib/awful/ewmh.lua.in index 25b856f10..e69282969 100644 --- a/lib/awful/ewmh.lua.in +++ b/lib/awful/ewmh.lua.in @@ -142,7 +142,17 @@ function ewmh.activate(c) end end +-- Tag a window with its requested tag +function ewmh.tag(c, t) + if not t then + c.sticky = true + else + c:tags({ t }) + end +end + client.connect_signal("request::activate", ewmh.activate) +client.connect_signal("request::tag", ewmh.tag) client.connect_signal("request::maximized_horizontal", maximized_horizontal) client.connect_signal("request::maximized_vertical", maximized_vertical) client.connect_signal("request::fullscreen", fullscreen) diff --git a/objects/client.c b/objects/client.c index 9a4522357..591aa17a0 100644 --- a/objects/client.c +++ b/objects/client.c @@ -2421,6 +2421,7 @@ luaA_class_add_property(&client_class, "startup_id", signal_add(&client_class.signals, "request::fullscreen"); signal_add(&client_class.signals, "request::maximized_horizontal"); signal_add(&client_class.signals, "request::maximized_vertical"); + signal_add(&client_class.signals, "request::tag"); signal_add(&client_class.signals, "tagged"); signal_add(&client_class.signals, "unfocus"); signal_add(&client_class.signals, "unmanage");