awful.tag.withcurrent: Also act on restarts (FS#1155)

When awesome restarts because a new screen was added or removed, clients can end
up being on a different screen than before the restart. However, the tags will
be carried across the restart. This means that a client could end up being
tagged with a tag from another screen. This results in weird behavior of tag
switches and confuses users.

To work around this, remove the client from any tags that are on a different
screen during startup. If the client ends up without any tags, it will then be
tagged with the currently selected tags.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2013-10-08 10:45:22 +02:00
parent efd243b6d7
commit 4abf42b92f
1 changed files with 9 additions and 12 deletions

View File

@ -518,20 +518,17 @@ end
--- Tag a client with the set of current tags. --- Tag a client with the set of current tags.
-- @param c The client to tag. -- @param c The client to tag.
-- @param startup Optional: don't do anything if true. function tag.withcurrent(c)
function tag.withcurrent(c, startup) local tags = {}
if startup ~= true then for k, t in ipairs(c:tags()) do
local tags = {} if tag.getscreen(t) == c.screen then
for k, t in ipairs(c:tags()) do table.insert(tags, t)
if tag.getscreen(t) == c.screen then
table.insert(tags, t)
end
end end
if #tags == 0 then
tags = tag.selectedlist(c.screen)
end
c:tags(tags)
end end
if #tags == 0 then
tags = tag.selectedlist(c.screen)
end
c:tags(tags)
end end
local function attached_connect_signal_screen(screen, sig, func) local function attached_connect_signal_screen(screen, sig, func)