Module awful.menu
Info:
- Copyright: 2008, 2011 Damien Leone, Julien Danjou, dodo
- Release: v3.5.1
- Author: Damien Leone <damien.leone@gmail.com>,Julien Danjou <julien@danjou.info>,dodo
Functions
menu:show () | Show a menu. |
menu:hide () | Hide a menu popup. |
menu:toggle (_menu) | 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 ()
- Show a menu.
- menu:hide ()
- Hide a menu popup.
- menu:toggle (_menu)
-
Toggle menu visibility.
Parameters:
- _menu The menu to show if it's hidden, or to hide if it's shown.
- 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 params
- index (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 menu
- args 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 <code>match_any</code> instead of <code>match</code>, menu of clients with different classes can also be build. <p><code> function terminal_menu () <br/> terms = {} <br/> for i, c in pairs(client.get()) do <br/> if awful.rules.match(c, {class = "URxvt"}) then <br/> terms[i] = <br/> {c.name, <br/> function() <br/> awful.tag.viewonly(c:tags()[1]) <br/> client.focus = c <br/> end, <br/> c.icon <br/> } <br/> end <br/> end <br/> awful.menu(terms):show() <br/> end <br/> </code></p>
- args
Table containing the menu informations.