awful.rules: Fix switchtotag with tag names

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-10 11:32:53 +02:00 committed by Uli Schlachter
parent 9efc5ca409
commit fb8c70b07d
1 changed files with 7 additions and 3 deletions

View File

@ -211,6 +211,7 @@ end
-- @tab props Properties to apply.
-- @tab[opt] callbacks Callbacks to apply.
function rules.execute(c, props, callbacks)
local switchtotag = props.switchtotag
for property, value in pairs(props) do
if property ~= "focus" and type(value) == "function" then
value = value(c)
@ -225,14 +226,12 @@ function rules.execute(c, props, callbacks)
end
c.screen = t.screen
c:tags({ t })
elseif property == "switchtotag" and value and props.tag then
props.tag:view_only()
elseif property == "height" or property == "width" or
property == "x" or property == "y" then
local geo = c:geometry();
geo[property] = value
c:geometry(geo);
elseif property == "focus" then
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
@ -242,6 +241,11 @@ function rules.execute(c, props, callbacks)
end
end
-- Only do this after the tag has been (possibly) set
if switchtotag and c.first_tag then
c.first_tag:view_only()
end
-- Apply all callbacks.
if callbacks then
for _, callback in pairs(callbacks) do