Lua API reference
The config's main.lua runs with these globals. Everything else is reached from wm.
Notation
Type?isTypeornil."a" | "b"is a string that is one of the listed values.- Indexes start at 1. Coordinates are logical pixels.
- A member marked read only can be read but not set.
Event headings show the event's name and what its handler gets, like "resized" (window: Window). When the event is on an object, that object comes last. Requests are events too: an app asking for something, such as to be maximized, that the config decides whether to do.
Comparing
Objects that stand for one thing in the compositor compare with ==: windows, layers, outputs, seats and drawables, and also keysyms and mouse buttons. A Point or Rect is only equal to itself, so compare its fields.
Errors
- Reading or setting a field a Hazel object doesn't have raises an error naming the type and the field, for example
Output has no field "colour". - Setting a field that can only be read raises an error like
Window.id is read-only. KeyandButtonraise an error for names they don't know.
Type definitions
hazel --dump-typedefs prints LuaLS type definitions for the whole API. The repository keeps them in lua/types.lua.