Module awful.menu
Functions
| menu:show (args.coords) | Show a menu. |
| menu:hide () | Hide a menu popup. |
| menu:toggle (_menu, args.coords) | Toggle menu visibility. |
| menu:update () | Update menu content |
| menu:get_root () | Get the elder parent so for example when you kill it, it will destroy the whole family. |
| menu:add (args, index) | Add a new menu entry. |
| menu:clients (_menu) | Build a popup menu with running clients and shows it. |
| entry (parent, args) | Default awful.menu.entry constructor |
| new (args, parent) | Create a menu popup. |
Tables
| menu_keys | Key bindings for menu navigation. |
Functions
- menu:show (args.coords)
-
Show a menu.
Parameters:
args.coords: Menu position defaulting to mouse.coords()
- menu:hide ()
- Hide a menu popup.
- menu:toggle (_menu, args.coords)
-
Toggle menu visibility.
Parameters:
_menu: The menu to show if it's hidden, or to hide if it's shown.args.coords: Menu position {x,y}
- menu:update ()
- Update menu content
- menu:get_root ()
- Get the elder parent so for example when you kill it, it will destroy the whole family.
- menu:add (args, index)
-
Add a new menu entry.
args.new (Default: awful.menu.entry) The menu entry constructor.
args.theme (Optional) The menu entry theme.
args.* params needed for the menu entry constructor.
Parameters:
args: The item paramsindex: (Optional) the index where the new entry will inserted
- menu:clients (_menu)
-
Build a popup menu with running clients and shows it.
Parameters:
_menu: Menu table, see new() function for more informations
Returns:
-
The menu.
- entry (parent, args)
-
Default awful.menu.entry constructor
Parameters:
parent: The parent menuargs: the item params
Returns:
-
table with 'widget', 'cmd', 'akey' and all the properties the user wants to change
- new (args, parent)
-
Create a menu popup.
Parameters:
args: Table containing the menu informations.
- Key items: Table containing the displayed items. Each element is a table by default (when element 'new' is awful.menu.entry) containing: item name, triggered action, submenu table or function, item icon (optional).
- Keys theme.[fg|bg]_[focus|normal], theme.border_color, theme.border_width, theme.submenu_icon, theme.height and theme.width override the default display for your menu and/or of your menu entry, each of them are optional.
- Key auto_expand controls the submenu auto expand behaviour by setting it to true (default) or false.
parent: Specify the parent menu 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_anyinstead ofmatch, 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
awful.menu(terms):show()
end