From 697a88958e9d51c2b393398bbc0e13a5206ceabd Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 5 May 2016 18:29:35 +0200 Subject: [PATCH 1/2] client_manage: Check for _NET_STARTUP_ID on WM_CLIENT_LEADER Apparently the spec allows to set the _NET_STARTUP_ID value on the property that WM_CLIENT_LEADER points to instead of the window itself. Thus, if we don't find a _NET_STARTUP_ID on the window itself, check again on the client leader window. Apparently GTK even does this (for whatever reason...)... Signed-off-by: Uli Schlachter --- objects/client.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/objects/client.c b/objects/client.c index b1ae5c4da..656fd953e 100644 --- a/objects/client.c +++ b/objects/client.c @@ -1241,8 +1241,19 @@ HANDLE_GEOM(height) xcb_get_property_reply(globalconf.connection, startup_id_q, NULL); /* Say spawn that a client has been started, with startup id as argument */ char *startup_id = xutil_get_text_property_from_reply(reply); - c->startup_id = startup_id; p_delete(&reply); + + if (startup_id == NULL && c->leader_window != XCB_NONE) { + /* GTK hides this property elsewhere. No idea why. */ + startup_id_q = xcb_get_property(globalconf.connection, false, + c->leader_window, _NET_STARTUP_ID, + XCB_GET_PROPERTY_TYPE_ANY, 0, UINT_MAX); + reply = xcb_get_property_reply(globalconf.connection, startup_id_q, NULL); + startup_id = xutil_get_text_property_from_reply(reply); + p_delete(&reply); + } + c->startup_id = startup_id; + spawn_start_notify(c, startup_id); luaA_class_emit_signal(L, &client_class, "list", 0); From 6b4a2625cb1334f47934cc7089395e92b8d0c773 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 5 May 2016 18:33:18 +0200 Subject: [PATCH 2/2] test-spawn-snid.lua: Use test client instead of urxvt Startup notification support in urxvt is optional while GTK always supports startup notification. Thus, use the new GTK-based test client for the SN tests. Fixes: https://github.com/awesomeWM/awesome/issues/848 Signed-off-by: Uli Schlachter --- tests/_client.lua | 4 ++-- tests/test-spawn-snid.lua | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/_client.lua b/tests/_client.lua index 10f0700ea..1275584b2 100644 --- a/tests/_client.lua +++ b/tests/_client.lua @@ -3,7 +3,7 @@ local spawn = require("awful.spawn") -- This file provide a simple, yet flexible, test client. -- It is used to test the `awful.rules` -return function(class, title) +return function(class, title, use_sn) title = title or 'Awesome test client' local cmd = {"lua" , "-e", table.concat { @@ -28,5 +28,5 @@ return function(class, title) "app:run {''}" }} - spawn(cmd) + return spawn(cmd, use_sn) end diff --git a/tests/test-spawn-snid.lua b/tests/test-spawn-snid.lua index 2aaadc084..1bfb706a6 100644 --- a/tests/test-spawn-snid.lua +++ b/tests/test-spawn-snid.lua @@ -1,7 +1,7 @@ --- Tests for spawn's startup notifications. local runner = require("_runner") -local spawn = require("awful.spawn") +local test_client = require("_client") local manage_called, c_snid @@ -15,7 +15,7 @@ local ret, snid local steps = { function(count) if count == 1 then - ret, snid = spawn('urxvt', true) + ret, snid = test_client("foo", "bar", true) elseif manage_called then assert(ret) assert(snid) @@ -29,7 +29,7 @@ local steps = { function(count) if count == 1 then manage_called = false - ret, snid = spawn('urxvt', false) + ret, snid = test_client("bar", "foo", false) elseif manage_called then assert(ret) assert(snid == nil)