Module init
AwesomeWM - Slot
A declarative API to connect signals for the AwesomeWM.
It completes the native gears.signal
module to make signal connection
easier to manage.
Usage example
Tis module allows to create Slot objects. These object can connect to any
signals from Awesome WM's gears.object
s and module level signals.
In the following example, we create a slot that connects to the client
global "request::default_keybindings"
signal to attach keybindings to
clients.
The slot.slots.client.append_keybindings
function is part of this module
and is defined as a function iterating over the keybindings
parameter to
register all defined keybindings with the awful.keyboard.append_client_keybindings
function.
local client_keybinding = slot { id = "CLIENT_KEY_BINDINGS", connect = true, target = capi.client, signal = "request::default_keybindings", slot = slot.slots.client.append_keybindings, slot_params = { keybindings = { awful.key({ "Mod4" }, "f", function(client) client.fullscreen = not client.fullscreen client:raise() end, { description = "toggle fullscreen", group = "client" }), }, -- ... }, }
Info:
- Copyright: 2021 Aire-One aireone@aireone.xyz
- Author: Aire-One
Constructor
awesome_slot | Create a new Slot instance. |
Static functions
awesome_slot.get_slot | Find a previously registered slot. |
awesome_slot.remove | Remove a registered slot and disconnect it. |
awesome_slot.connect | Connect a slot to its signal. |
awesome_slot.disconnect | Disconnect a slot from its signal. |
Tables
awesome_slot.slots | Slots defined by this module. |
awesome_slot.static_connect | Special objects that require a static connection instead of object level connection. |
Constructor
- awesome_slot line 116
-
Create a new Slot instance.
Parameters:
- params
- id string The slot ID. (optional)
- target any The slot target object.
- signal string The signal the slot connects to.
- slot function The callback function to connect to the signal.
- slot_params table The parameters to pass to the callback function. (The signal will invoke the callback function with this table as parameter) (optional)
- connect boolean Connect the slot now. (default true)
- params
Static functions
- awesome_slot.get_slot line 95
-
Find a previously registered slot.
If the slot asked doesn't exist, the function will fail and throw an error.
Parameters:
- slot string or Slot The slot id or instance to find.
- awesome_slot.remove line 141
-
Remove a registered slot and disconnect it.
Parameters:
- slot Slot The slot to remove.
- awesome_slot.connect line 156
-
Connect a slot to its signal.
Parameters:
- slot Slot The slot to connect.
- awesome_slot.disconnect line 178
-
Disconnect a slot from its signal.
Parameters:
- slot Slot The slot to disconnect.