From 6963ede3dca9d45e6813b4a099ffe8f8fa2dd46e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 21 Jan 2015 12:38:49 +0100 Subject: [PATCH] awful.rules.execute: use delayed_call for emitting request::activate This is a followup to commit 90fde13, which caused the client not to be visible during the request::activate callback. This requires an initial call to `awesome_refresh` before the main loop to get `awesome.startup` right. Ref: https://github.com/awesomeWM/awesome/commit/90fde139#commitcomment-9308225 --- awesome.c | 4 ++++ lib/awful/rules.lua.in | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/awesome.c b/awesome.c index 6e0213d5..b847603c 100644 --- a/awesome.c +++ b/awesome.c @@ -545,6 +545,10 @@ main(int argc, char **argv) g_main_context_set_poll_func(g_main_context_default(), &a_glib_poll); gettimeofday(&last_wakeup, NULL); + /* Do all deferred work now once outside of the loop to get awesome.startup + * right. */ + awesome_refresh(); + /* main event loop */ globalconf.loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(globalconf.loop); diff --git a/lib/awful/rules.lua.in b/lib/awful/rules.lua.in index e344828c..daaf0728 100644 --- a/lib/awful/rules.lua.in +++ b/lib/awful/rules.lua.in @@ -12,6 +12,7 @@ local ipairs = ipairs local pairs = pairs local aclient = require("awful.client") local atag = require("awful.tag") +local timer = require("gears.timer") --- Apply rules to clients at startup. -- awful.rules @@ -234,7 +235,10 @@ function rules.execute(c, props, callbacks) -- Do this at last so we do not erase things done by the focus -- signal. if props.focus and (type(props.focus) ~= "function" or props.focus(c)) then - c:emit_signal('request::activate',"rules") + local cb = function(c) + c:emit_signal('request::activate', "rules") + end + timer.delayed_call(cb, c) end end