Hi all.

Tag toggling was broken for me after v3.2-31-g6430738. I came up with the
attached patch (git format-patch'ed) to work around it. Seems good to
me, although I'm by no means a Lua adept.

Cheers.

\n\n
>From 650592776ba227eba22e0be91aa1df51148a8232 Mon Sep 17 00:00:00 2001
From: Nikos Ntarmos <ntar...@cs.uoi.gr>
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 <ntar...@cs.uoi.gr>
---
 lib/awful/client.lua.in |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in
index de66f94..2a29740 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
-- 
1.6.1.3

Reply via email to