$OpenBSD: patch-lib_awful_menu_lua_in,v 1.2 2014/01/21 14:30:30 dcoppa Exp $

commit 479f7b990cf411bc116f728eea8edc0ea6b4b8d3
Author: Uli Schlachter <psychon@znc.in>
Date:   Sat Jan 11 21:23:23 2014 +0100

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 <psychon@znc.in>

commit 77e92e17a1ec1711233f42560b5b339944ce71b2
Author: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Date:   Thu Dec 26 15:50:10 2013 +0100

menu: do not double escape name in 'menu:clients()' (FS#1202)

Label of menu entries will be escaped automatically.  Doing it manually
in menu:clients() will escape it it twice.

Patch removes the util.escape() call in menu:clients()

Signed-off-by: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>

--- lib/awful/menu.lua.in.orig	Sat Oct 12 18:48:49 2013
+++ lib/awful/menu.lua.in	Tue Jan 21 15:19:54 2014
@@ -455,15 +455,16 @@ 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
-    _menu = self or {}
+function menu.clients(args, item_args)
     local cls = capi.client.get()
     local cls_t = {}
     for k, c in pairs(cls) do
         cls_t[#cls_t + 1] = {
-            util.escape(c.name) or "",
+            c.name or "",
             function ()
                 if not c:isvisible() then
                     tags.viewmore(c:tags(), c.screen)
@@ -472,6 +473,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 {}
