EWMH: Handle _NET_WM_DESKTOP in lua

We now handle all "important" EWMH messages in lua and lua can decide to do
different things than the current obvious one.

Consistency!

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2014-03-17 16:15:20 +01:00
parent 9e4270f2e7
commit 873358a0b8
3 changed files with 21 additions and 9 deletions

19
ewmh.c
View File

@ -366,18 +366,19 @@ ewmh_process_desktop(client_t *c, uint32_t desktop)
if(desktop == 0xffffffff) if(desktop == 0xffffffff)
{ {
luaA_object_push(globalconf.L, c); 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); lua_pop(globalconf.L, 1);
} }
else if (idx >= 0 && idx < globalconf.tags.len) 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, c);
{ luaA_object_push(globalconf.L, globalconf.tags.tab[idx]);
luaA_object_push(globalconf.L, globalconf.tags.tab[i]); luaA_object_emit_signal(globalconf.L, -2, "request::tag", 1);
tag_client(c); /* Pop the client, arguments are already popped */
} lua_pop(globalconf.L, 1);
else }
untag_client(c, globalconf.tags.tab[i]);
} }
int int

View File

@ -142,7 +142,17 @@ function ewmh.activate(c)
end end
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::activate", ewmh.activate)
client.connect_signal("request::tag", ewmh.tag)
client.connect_signal("request::maximized_horizontal", maximized_horizontal) client.connect_signal("request::maximized_horizontal", maximized_horizontal)
client.connect_signal("request::maximized_vertical", maximized_vertical) client.connect_signal("request::maximized_vertical", maximized_vertical)
client.connect_signal("request::fullscreen", fullscreen) client.connect_signal("request::fullscreen", fullscreen)

View File

@ -2398,6 +2398,7 @@ luaA_class_add_property(&client_class, "startup_id",
signal_add(&client_class.signals, "request::fullscreen"); signal_add(&client_class.signals, "request::fullscreen");
signal_add(&client_class.signals, "request::maximized_horizontal"); signal_add(&client_class.signals, "request::maximized_horizontal");
signal_add(&client_class.signals, "request::maximized_vertical"); 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, "tagged");
signal_add(&client_class.signals, "unfocus"); signal_add(&client_class.signals, "unfocus");
signal_add(&client_class.signals, "unmanage"); signal_add(&client_class.signals, "unmanage");