Created
March 15, 2014 22:02
-
-
Save Elv13/9574561 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/awful/util.lua.in b/lib/awful/util.lua.in | |
index 0a90b76..50b517d 100644 | |
--- a/lib/awful/util.lua.in | |
+++ b/lib/awful/util.lua.in | |
@@ -73,6 +73,8 @@ end | |
-- @param cmd The command. | |
-- @param sn Enable startup-notification. | |
-- @return The awesome.spawn return value. | |
+-- @return The forked PID. | |
+-- @return The startup notification UID. | |
function util.spawn(cmd, sn) | |
if cmd and cmd ~= "" then | |
if sn == nil then sn = true end | |
diff --git a/luadoc/client.lua b/luadoc/client.lua | |
index 2e0c181..76f982e 100644 | |
--- a/luadoc/client.lua | |
+++ b/luadoc/client.lua | |
@@ -45,6 +45,7 @@ module("client") | |
-- @field shape_clip The client's clip shape as set by awesome as a (native) cairo surface. | |
-- @field shape_client_bounding The client's bounding shape as set by the program as a (native) cairo surface. | |
-- @field shape_client_clip The client's clip shape as set by the program as a (native) cairo surface. | |
+-- @field startup_id The FreeDesktop StartId. | |
-- @class table | |
-- @name client | |
diff --git a/objects/client.c b/objects/client.c | |
index bb7fce7..420d8d6 100644 | |
--- a/objects/client.c | |
+++ b/objects/client.c | |
@@ -576,9 +576,9 @@ 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); | |
spawn_start_notify(c, startup_id); | |
- p_delete(&startup_id); | |
} | |
luaA_class_emit_signal(globalconf.L, &client_class, "list", 0); | |
@@ -1211,6 +1211,9 @@ client_unmanage(client_t *c, bool window_valid) | |
/* set client as invalid */ | |
c->window = XCB_NONE; | |
+ /* Free the startup id */ | |
+ p_delete(&c->startup_id); | |
+ | |
luaA_object_unref(globalconf.L, c); | |
} | |
@@ -1788,6 +1791,7 @@ LUA_OBJECT_EXPORT_PROPERTY(client, client_t, sticky, lua_pushboolean) | |
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, size_hints_honor, lua_pushboolean) | |
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, maximized_horizontal, lua_pushboolean) | |
LUA_OBJECT_EXPORT_PROPERTY(client, client_t, maximized_vertical, lua_pushboolean) | |
+LUA_OBJECT_EXPORT_PROPERTY(client, client_t, startup_id, lua_pushstring) | |
static int | |
luaA_client_get_content(lua_State *L, client_t *c) | |
@@ -2302,6 +2306,10 @@ client_class_setup(lua_State *L) | |
(lua_class_propfunc_t) luaA_client_set_shape_clip, | |
(lua_class_propfunc_t) luaA_client_get_shape_clip, | |
(lua_class_propfunc_t) luaA_client_set_shape_clip); | |
+luaA_class_add_property(&client_class, "startup_id", | |
+ NULL, | |
+ (lua_class_propfunc_t) luaA_client_get_startup_id, | |
+ NULL); | |
luaA_class_add_property(&client_class, "client_shape_bounding", | |
NULL, | |
(lua_class_propfunc_t) luaA_client_get_client_shape_bounding, | |
diff --git a/objects/client.h b/objects/client.h | |
index 5375418..d972205 100644 | |
--- a/objects/client.h | |
+++ b/objects/client.h | |
@@ -64,6 +64,8 @@ struct client_t | |
char *class, *instance; | |
/** Window geometry */ | |
area_t geometry; | |
+ /** Startup ID */ | |
+ char *startup_id; | |
/** True if the client is sticky */ | |
bool sticky; | |
/** Has urgency hint */ | |
diff --git a/spawn.c b/spawn.c | |
index 749b436..c233fb9 100644 | |
--- a/spawn.c | |
+++ b/spawn.c | |
@@ -368,7 +368,11 @@ luaA_spawn(lua_State *L) | |
/* push pid on stack */ | |
lua_pushnumber(L, pid); | |
- return 1; | |
+ /* push sn on stack */ | |
+ if (context) | |
+ lua_pushstring(L,sn_launcher_context_get_startup_id(context)); | |
+ | |
+ return (context)?2:1; | |
} | |
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment