From a91e31dbe673c25332e3b794202d51cc4775a526 Mon Sep 17 00:00:00 2001 From: Nikos Ntarmos Date: Thu, 23 Apr 2009 13:53:24 +0300 Subject: [PATCH] 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 Signed-off-by: Julien Danjou --- lib/awful/client.lua.in | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index de66f940..2a297408 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -443,12 +443,19 @@ function toggletag(target, c) -- Check that tag and client screen are identical if sel and sel.screen == target.screen then 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 #tags == 1 then return end - tags[tags[target]] = nil + tags[index] = nil else - tags[target] = target + tags[#tags + 1] = target end sel:tags(tags) end