Module awesome-ez

Create key and button bindings from simple definitions.

Info:

  • Copyright: 2019 James Reed
  • Author: James Reed <jcrd@tuta.io> et al.

Functions

ez.util.cb_from_table (cb) Convert a table into a callable function.
ez.util.parse_key (keydef) Parse a key definition string into modifiers and a key.
ez.util.parse_button (btndef) Parse a button definition string into modifiers and a button.
ez.key (keydef, cb) Create a key binding from a key definition string and callback.
ez.btn (btndef, cb) Create a button binding from a button definition string and callback.
ez.keytable (tbl) Create key bindings for elements of a table.
ez.btntable (tbl) Create button bindings for elements of a table.


Functions

ez.util.cb_from_table (cb)
Convert a table into a callable function.

The first element of the table should be a function, followed by arguments to this function.

Parameters:

  • cb The callback or a table describing the callback.

Returns:

    The callback.

Usage:

    local cb = ez.util.cb_from_table({awful.spawn, "xterm"})
ez.util.parse_key (keydef)
Parse a key definition string into modifiers and a key.

Key definition strings consist of modifier characters and a key separated by hyphens, e.g. "M-S-x" is the combination of Mod4, Shift, and the x key. If the key is surrounded by <>, it is interpreted as a key group, e.g. "M-<numrow> uses the modifier Mod4 and the key group "numrow".

The modifier key strings are: M = Mod4, A = Mod1, S = Shift, C = Control.

Parameters:

  • keydef The key definition string.

Returns:

    A table of modifiers and the key.

Usage:

    local modkeys, key = ez.util.parse_key("M-Return")
ez.util.parse_button (btndef)
Parse a button definition string into modifiers and a button.

Button definition strings consist of modifier characters and a key separated by hyphens, e.g. "M-S-1" is the combination of Mod4, Shift, and button 1.

The modifier key strings are: M = Mod4, A = Mod1, S = Shift, C = Control.

Parameters:

  • btndef The button definition string.

Returns:

    A table of modifiers and the button.

Usage:

    local modkeys, btn = ez.util.parse_button("M-1")
ez.key (keydef, cb)
Create a key binding from a key definition string and callback.

Parameters:

  • keydef The key definition string.
  • cb The callback or table describing the callback.

Returns:

    A table with the key objects.
ez.btn (btndef, cb)
Create a button binding from a button definition string and callback.

Parameters:

  • btndef The button definition string.
  • cb The callback or table describing the callback.

Returns:

    A table with the button objects.
ez.keytable (tbl)
Create key bindings for elements of a table.

Parameters:

  • tbl The table of key bindings.

Returns:

    A table containing created key objects.
ez.btntable (tbl)
Create button bindings for elements of a table.

Parameters:

  • tbl The table of button bindings.

Returns:

    A table containing created button objects.
generated by LDoc 1.4.6 Last updated 2020-08-15 14:31:05