diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in index 8cd6c519..4b11d8c9 100644 --- a/lib/awful/menu.lua.in +++ b/lib/awful/menu.lua.in @@ -386,6 +386,32 @@ end -- -- @param parent Specify the parent menu if we want to open a submenu, this value should never be set by the user. -- @param num Specify the parent's clicked item number if we want to open a submenu, this value should never be set by the user. +-- @usage The following function builds, and shows a menu of clients that match +-- a particular rule. Bound to a key, it can for example be used to select from +-- dozens of terminals open on several tags. With the use of +-- match_any instead of match, menu of clients with +-- different classes can also be build. +-- +--

+-- function terminal_menu ()
+--   terms = {}
+--   for i, c in pairs(client.get()) do
+--    if awful.rules.match(c, {class = "URxvt"}) then
+--     terms[i] =
+--     {c.name,
+--     function()
+--      awful.tag.viewonly(c:tags()[1])
+--      client.focus = c
+--     end,
+--     c.icon
+--     }
+--    end
+--   end
+--   m = awful.menu({items = terms})
+--   m:show({keygrabber=true})
+--   return m
+-- end
+--

function new(menu, parent, num) -- Create a table to store our menu informations local data = {}