awful.rules: Avoid trying to set some properties

This avoid unwanted signals or properties being set twice.
This commit is contained in:
Emmanuel Lepage Vallee 2016-04-14 23:51:17 -04:00
parent ddf14a3ffc
commit 090f2b83ac
1 changed files with 17 additions and 9 deletions

View File

@ -253,8 +253,11 @@ rules.extra_properties = {}
-- @tfield table awful.rules.high_priority_properties
rules.high_priority_properties = {}
rules.delayed_properties = {
focus = function() end,
rules.delayed_properties = {}
local force_ignore = {
titlebars_enabled=true, focus=true, screen=true, x=true,
y=true, width=true, height=true, geometry=true
}
function rules.high_priority_properties.tag(c, value)
@ -349,7 +352,10 @@ function rules.execute(c, props, callbacks)
value = value(c, props)
end
if not rules.high_priority_properties[property] and not rules.delayed_properties[property] then
local ignore = rules.high_priority_properties[property] or
rules.delayed_properties[property] or force_ignore[property]
if not ignore then
if rules.extra_properties[property] then
rules.extra_properties[property](c, value)
elseif type(c[property]) == "function" then
@ -369,6 +375,7 @@ function rules.execute(c, props, callbacks)
-- Apply the delayed properties
for prop, handler in pairs(rules.delayed_properties) do
if not force_ignore[prop] then
local value = props[prop]
if value ~= nil then
@ -379,6 +386,7 @@ function rules.execute(c, props, callbacks)
handler(c, value, props)
end
end
end
-- 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