From 8766ffcbd77bcc47fda861ba41e20c18467a633d Mon Sep 17 00:00:00 2001 From: Gregor Best Date: Tue, 27 Jan 2009 19:28:51 +0100 Subject: [PATCH] awful.widget: fix widget<->tag association Signed-off-by: Gregor Best Signed-off-by: Julien Danjou --- 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 29d2f8da4..9b6d89636 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 2a460a1e9..0b9107b72 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