Leon Winter wrote: > 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 >
I just noticed, icon get resized normally, but not if we use bg_image. Nevertheless i added a further patch that will resize the icon. You may merge both. I tested the patches and the icons looks pretty anoying, this crop and resize function screw my icons :F Actually i have no idea why the icons looks pretty uncool. You may look yourself and find a solution, but may not merge until icons look good again (: Regards, Leon Winter
>From 2e9dbbf2c42ff3ef2a70d053a0c4da6e3fafbddd Mon Sep 17 00:00:00 2001 From: Leon Winter <[email protected]> Date: Mon, 15 Dec 2008 08:16:06 +0100 Subject: [PATCH] awful.menu: resize icon if needed --- lib/awful/menu.lua.in | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in index b52d0c2..8d50f2b 100644 --- a/lib/awful/menu.lua.in +++ b/lib/awful/menu.lua.in @@ -17,6 +17,7 @@ local capi = { screen = screen, mouse = mouse, client = client } local util = require("awful.util") local tags = require("awful.tag") local awbeautiful = require("beautiful") +local tonumber = tonumber --- Menu module for awful module("awful.menu") @@ -122,7 +123,11 @@ local function add_item(data, num, item_info) 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] + local icon = type(item_info[3]) == "string" and image(item_info[3]) or item_info[3] + if icon.width > tonumber(data.h) then + icon = icon:crop_and_scale(0,0,icon.height,icon.width,data.h,data.h) + end + label.bg_image = icon end label:buttons(bindings) -- 1.5.6.5
