Fix toggletag

awful.client.toggletag assumes that the tags array is indexed by tag
objects. This appears to not be the case after v3.2-31-g6430738, when
client objects stopped using otables. This patch makes toggletag iterate
through the client tag array till it finds the entry to remove,
otherwise it appends the new entry at the end.

Signed-off-by: Nikos Ntarmos <ntarmos@cs.uoi.gr>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Nikos Ntarmos 2009-04-23 13:53:24 +03:00 committed by Julien Danjou
parent 241ff97666
commit a91e31dbe6
1 changed files with 10 additions and 3 deletions

View File

@ -443,12 +443,19 @@ function toggletag(target, c)
-- Check that tag and client screen are identical -- Check that tag and client screen are identical
if sel and sel.screen == target.screen then if sel and sel.screen == target.screen then
local tags = sel:tags() local tags = sel:tags()
if tags[target] then local index = nil;
for i, v in ipairs(tags) do
if v == target then
index = i
break
end
end
if index then
-- If it's the only tag for the window, stop. -- If it's the only tag for the window, stop.
if #tags == 1 then return end if #tags == 1 then return end
tags[tags[target]] = nil tags[index] = nil
else else
tags[target] = target tags[#tags + 1] = target
end end
sel:tags(tags) sel:tags(tags)
end end