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 <julien@danjou.info>
This commit is contained in:
Anton Bobrov 2009-10-25 00:05:09 +11:00 committed by Julien Danjou
parent e7819ec211
commit 148e095fa9
1 changed files with 26 additions and 22 deletions

View File

@ -81,16 +81,22 @@ end
--- Apply rules to a client. --- Apply rules to a client.
-- @param c The client. -- @param c The client.
function apply(c) function apply(c)
local props = {}
for _, entry in ipairs(rules) do for _, entry in ipairs(rules) do
if match(c, entry.rule) then if match(c, entry.rule) then
for property, value in pairs(entry.properties) do for property, value in pairs(entry.properties) do
props[property] = value
end
end
end
for property, value in pairs(props) do
if property == "floating" then if property == "floating" then
aclient.floating.set(c, value) aclient.floating.set(c, value)
elseif property == "tag" then elseif property == "tag" then
aclient.movetotag(value, c) aclient.movetotag(value, c)
elseif property == "switchtotag" and value elseif property == "switchtotag" and value and props.tag then
and entry.properties["tag"] then atag.viewonly(props.tag)
atag.viewonly(entry.properties["tag"])
elseif property == "height" or property == "width" or elseif property == "height" or property == "width" or
property == "x" or property == "y" then property == "x" or property == "y" then
local geo = c:geometry(); local geo = c:geometry();
@ -104,11 +110,9 @@ function apply(c)
end end
-- Do this at last so we do not erase things done by the focus -- Do this at last so we do not erase things done by the focus
-- signal. -- signal.
if entry.properties.focus then if props.focus then
client.focus = c client.focus = c
end end
end
end
end end
client.add_signal("manage", apply) client.add_signal("manage", apply)