From 79e16cf950ba15308a2d4f1d5b417f6681a41e30 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 12 Apr 2016 09:33:39 +0200 Subject: [PATCH] awful.rules.execute: Make for loop easier to read Signed-off-by: Uli Schlachter --- lib/awful/rules.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/awful/rules.lua b/lib/awful/rules.lua index f06ee5d5a..d470d8c7e 100644 --- a/lib/awful/rules.lua +++ b/lib/awful/rules.lua @@ -211,7 +211,9 @@ end -- @tab props Properties to apply. -- @tab[opt] callbacks Callbacks to apply. function rules.execute(c, props, callbacks) + local handle_later = { focus = true, switchtotag = true } local switchtotag = props.switchtotag + for property, value in pairs(props) do if property ~= "focus" and type(value) == "function" then value = value(c) @@ -231,13 +233,12 @@ function rules.execute(c, props, callbacks) local geo = c:geometry(); geo[property] = value c:geometry(geo); - elseif property == "focus" or property == "switchtotag" then - -- This will be handled below - (function() end)() -- I haven't found a nice way to silence luacheck here - elseif type(c[property]) == "function" then - c[property](c, value) - else - c[property] = value + elseif not handle_later[property] then + if type(c[property]) == "function" then + c[property](c, value) + else + c[property] = value + end end end