From c96aa9866e437795589fd6cc8a3be3d6a6085aa1 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 11 Dec 2016 22:38:40 -0500 Subject: [PATCH] rules.tag: Prevent a screen mismatch As c:tags() doesn't (cannot) check for screen mismatch, then it has to be done. This is a follow up of 6f7019b2d0, see #1236. --- lib/awful/rules.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/awful/rules.lua b/lib/awful/rules.lua index af35db0e..8658a736 100644 --- a/lib/awful/rules.lua +++ b/lib/awful/rules.lua @@ -267,12 +267,18 @@ local force_ignore = { border_width=true,floating=true,size_hints_honor=true } -function rules.high_priority_properties.tag(c, value) +function rules.high_priority_properties.tag(c, value, props) if value then if type(value) == "string" then value = atag.find_by_name(c.screen, value) end + -- In case the tag has been forced to another screen, move the client + if c.screen ~= value.screen then + c.screen = value.screen + props.screen = value.screen -- In case another rule query it + end + c:tags{ value } end end @@ -372,7 +378,12 @@ end function rules.extra_properties.tags(c, value) local current = c:tags() - c:tags(util.table.merge(current, value)) + + if #current == 0 or (value[1] and value[1].screen ~= current[1].screen) then + c:tags(value) + else + c:tags(util.table.merge(current, value)) + end end --- Apply properties and callbacks to a client.