At Tue, 27 Jan 2009 19:30:24 +0100
Gregor Best wrote:

> Hi people,
> 
> the attached patch fixes the association of a widget to a tag and vice versa
> in awful.widget and thus makes awful.mouse.client.dragtotag.widget() work
> again.
> 
> It broke due to my recent changes in awful.widget which unified the tag- and
> tasklist update functions.
> 

Plus, i forgot to attach the patch :)

-- 
    Gregor Best
From cb104cbadcece2f38e43fb6f4794079b980af7df Mon Sep 17 00:00:00 2001
From: Gregor Best <[email protected]>
Date: Tue, 27 Jan 2009 19:28:51 +0100
Subject: [PATCH] awful.widget: fix widget<->tag association

Signed-off-by: Gregor Best <[email protected]>
---
 lib/awful/mouse.lua.in  |    2 +-
 lib/awful/widget.lua.in |   13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/awful/mouse.lua.in b/lib/awful/mouse.lua.in
index 29d2f8d..9b6d896 100644
--- a/lib/awful/mouse.lua.in
+++ b/lib/awful/mouse.lua.in
@@ -176,7 +176,7 @@ client.dragtotag = { }
 
 --- Move a client to a tag by drag'n'dropping it over a taglist widget
 -- @param c The client to move
-function client.dragtotag.widget(c, side)
+function client.dragtotag.widget(c)
     capi.mousegrabber.run(function (mouse)
                               local button_down = false
                               for _, v in ipairs(mouse.buttons) do
diff --git a/lib/awful/widget.lua.in b/lib/awful/widget.lua.in
index 2a460a1..c7a1d37 100644
--- a/lib/awful/widget.lua.in
+++ b/lib/awful/widget.lua.in
@@ -10,6 +10,7 @@ local pairs = pairs
 local table = table
 local otable = otable
 local type = type
+local math = math
 local capi =
 {
     screen = screen,
@@ -46,11 +47,19 @@ local function list_update(w, buttons, label, data, widgets, objects)
     -- Add more widgets
     if len < #objects then
         for i = len * 2 + 1, #objects * 2, 2 do
-            w[i] = capi.widget({ type = "imagebox", align = widgets.imagebox.align })
-            w[i + 1] = capi.widget({ type = "textbox", align = widgets.textbox.align })
+            local ib = capi.widget({ type = "imagebox", align = widgets.imagebox.align })
+            local tb = capi.widget({ type = "textbox", align = widgets.textbox.align })
+
+            w[i] = ib
+            w[i + 1] = tb
             w[i + 1]:margin({ left = widgets.textbox.margin.left, right = widgets.textbox.margin.right })
             w[i + 1].bg_resize = widgets.textbox.bg_resize or false
             w[i + 1].bg_align = widgets.textbox.bg_align or ""
+            
+            if type(objects[math.floor(i / 2) + 1]) == "tag" then
+                tagwidgets[ib] = objects[math.floor(i / 2) + 1]
+                tagwidgets[tb] = objects[math.floor(i / 2) + 1]
+            end
         end
     -- Remove widgets
     elseif len > #objects then
-- 
1.6.1

Attachment: signature.asc
Description: PGP signature

Reply via email to