awesomeWM/awesome — pull request #12 by Elv13 (2014-03-15 22:09:16+00:00)
Title: Add end to end support for spawning tracking using startup notifications

This allow to spawn something, then apply some properties or rules when
the client show up ("manage").

This commit add:
* "startup_id" property for all clients object (immutable, can be nil)
* Second return value to awful.util.spawn() with the startup_id
* Update the documentation

Example:

local wait_for_it = {}

local pid,snid = awful.util.spawn("urxvtc")
wait_for_it[snid] = {ontop=true,sticky=false,
tag = awful.tag.gettags(mouse.screen)[1] }

client.connect_signal("manage", function (c, startup)
if c.startup_id and wait_for_it[c.startup_id] then
for k,v in pairs(wait_for_it[c.startup_id]) do
c[k] = v
end
if wait_for_it[c.startup_id].tag then
c:tags({wait_for_it[c.startup_id].tag})
end
end
end)