From 479f7b990cf411bc116f728eea8edc0ea6b4b8d3 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 11 Jan 2014 21:23:23 +0100 Subject: [PATCH] awful.menu.clients: Fix API (FS#1200) This gets rid of the unused first argument and adds a new second argument that can influence individual items. Signed-off-by: Uli Schlachter --- lib/awful/menu.lua.in | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in index ee52b7043..8aac793a1 100644 --- a/lib/awful/menu.lua.in +++ b/lib/awful/menu.lua.in @@ -455,10 +455,12 @@ end -------------------------------------------------------------------------------- --- Build a popup menu with running clients and shows it. --- @param _menu Menu table, see new() function for more informations +-- @param args Menu table, see new() function for more informations +-- @param item_args Table that will be merged into each item, see new() for more +-- informations. -- @return The menu. -function menu:clients(args) -- FIXME crude api - local _menu = self or {} +function menu.clients(args, item_args) + local args = args or args1 local cls = capi.client.get() local cls_t = {} for k, c in pairs(cls) do @@ -472,6 +474,13 @@ function menu:clients(args) -- FIXME crude api c:raise() end, c.icon } + if item_args then + if type(item_args) == "function" then + table_merge(cls_t[#cls_t], item_args(c)) + else + table_merge(cls_t[#cls_t], item_args) + end + end end args = args or {} args.items = args.items or {}