Hi, i just wondered how complicated awful.menu is designed. Since we have .bg_image we can KISS :P
Patch attached ;) However there is a bug in awful.menu (and was before the patch aswell): Click on an item in the menu, then reopen the menu and point over the item you clicked before -> there will be no highlight background as usual. If you move your cursor elsewhere and over it again it will highlighted correctly again. Gregor could repro it, so its not only a problem to me alone. Unfortunately i was unable to find the bug yet, but i guess the bug will not survive the next days :D Regards, Leon Winter
>From 09ff8bcb1ce3b9cd00476de8875e651b15816fa6 Mon Sep 17 00:00:00 2001 From: Leon Winter <[email protected]> Date: Sun, 14 Dec 2008 19:50:05 +0100 Subject: [PATCH] awful.menu: use bg_image instead of imagebox --- lib/awful/menu.lua.in | 27 +++++++-------------------- 1 files changed, 7 insertions(+), 20 deletions(-) diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in index 6a19df1..b52d0c2 100644 --- a/lib/awful/menu.lua.in +++ b/lib/awful/menu.lua.in @@ -113,31 +113,18 @@ local function add_item(data, num, item_info) button({}, 3, function () hide(data) end) } - -- Create the item icon widget - local icon - if item_info[3] then - icon = widget({ type = "imagebox", align = "left" }) - if type(item_info[3]) == "string" then - icon.image = image(item_info[3]) - else - icon.image = item_info[3] - end - else - icon = widget({type = "textbox", align = "left" }) - icon.width = data.h - end - - icon:buttons(bindings) - - function icon.mouse_enter() mouse_enter(item, data.theme) end - function icon.mouse_leave() mouse_leave(item, data.theme) end - -- Create the item label widget local label = widget({ type = "textbox", align = "flex" }) label.text = " " .. item_info[1] + label:margin{left = data.h} + -- Set icon if needed + if item_info[3] then + label.bg_image = type(item_info[3]) == "string" and image(item_info[3]) or item_info[3] + end + label:buttons(bindings) function label.mouse_enter() mouse_enter(item, data.theme) end @@ -155,7 +142,7 @@ local function add_item(data, num, item_info) end -- Add widgets to the wibox - item.widgets = { icon, label, submenu } + item.widgets = { label, submenu } item.ontop = true -- 1.5.6.5
