From 148e095fa97013df9a2061494d473a6c4ad9358e Mon Sep 17 00:00:00 2001 From: Anton Bobrov Date: Sun, 25 Oct 2009 00:05:09 +1100 Subject: [PATCH] awful.rules: apply accumulated rule properties (FS#669) To avoid the screen flickering, when two rules have different tags with true switchtotag. Signed-off-by: Julien Danjou --- lib/awful/rules.lua.in | 48 +++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/lib/awful/rules.lua.in b/lib/awful/rules.lua.in index 8b6151f5..55bcc08f 100644 --- a/lib/awful/rules.lua.in +++ b/lib/awful/rules.lua.in @@ -81,34 +81,38 @@ end --- Apply rules to a client. -- @param c The client. function apply(c) + local props = {} for _, entry in ipairs(rules) do if match(c, entry.rule) then for property, value in pairs(entry.properties) do - if property == "floating" then - aclient.floating.set(c, value) - elseif property == "tag" then - aclient.movetotag(value, c) - elseif property == "switchtotag" and value - and entry.properties["tag"] then - atag.viewonly(entry.properties["tag"]) - elseif property == "height" or property == "width" or - property == "x" or property == "y" then - local geo = c:geometry(); - geo[property] = value - c:geometry(geo); - elseif type(c[property]) == "function" then - c[property](c, value) - else - c[property] = value - end - end - -- Do this at last so we do not erase things done by the focus - -- signal. - if entry.properties.focus then - client.focus = c + props[property] = value end end end + + for property, value in pairs(props) do + if property == "floating" then + aclient.floating.set(c, value) + elseif property == "tag" then + aclient.movetotag(value, c) + elseif property == "switchtotag" and value and props.tag then + atag.viewonly(props.tag) + elseif property == "height" or property == "width" or + property == "x" or property == "y" then + local geo = c:geometry(); + geo[property] = value + c:geometry(geo); + elseif type(c[property]) == "function" then + c[property](c, value) + else + c[property] = value + end + end + -- Do this at last so we do not erase things done by the focus + -- signal. + if props.focus then + client.focus = c + end end client.add_signal("manage", apply)