hw.bind
hw.bind("SHIFT+Q", function() local window = hw.window.at_cursor() if window then window:close() endend)Signature
Section titled “Signature”hw.bind(key: string, callback: fun())The key is case-insensitive, ignores token whitespace, and must contain exactly one non-modifier key.
Modifiers
Section titled “Modifiers”| Token | Meaning |
|---|---|
SHIFT |
Either left or right Shift |
CTRL, CONTROL |
Either left or right Control |
ALT |
Either left or right Alt |
LSHIFT, RSHIFT |
A specific Shift key |
LCTRL, LCONTROL |
Left Control |
RCTRL, RCONTROL |
Right Control |
LALT, RALT |
A specific Alt key |
Generic modifiers expand to both side-specific forms.
Do not include SUPER, LWIN, or RWIN in the binding string. The configured
SUPER key activates the binding layer.
Supported keys
Section titled “Supported keys”Letters A through Z, digits 0 through 9, and function keys F1 through
F24 are supported.
Named keys include:
BACKSPACE TAB RETURN ENTER ESCESCAPE SPACE PAGEUP PAGEDOWN ENDHOME LEFT UP RIGHT DOWNINSERT DELETE PAUSE PRINTSCREEN SNAPSHOTCAPSLOCK NUMLOCK SCROLLLOCKPERIOD COMMA MINUS PLUS SLASHBACKSLASH SEMICOLON QUOTE LBRACKET RBRACKETNUMPAD0 through NUMPAD9MULTIPLY ADD SUBTRACT DECIMAL DIVIDEAn invalid binding causes a configuration error when registered.
Dispatch behavior
Section titled “Dispatch behavior”Bindings run synchronously with a 50 ms Lua bytecode watchdog. Native API calls cannot be interrupted and may delay other bindings and timers.
An error or timeout aborts only the current binding and is written to the log. It does not place HyprWin in safe mode.
Repeated key-down messages are ignored until the key is released.
Inspect registered bindings
Section titled “Inspect registered bindings”for _, binding in ipairs(hw.binds()) do print(binding)endhw.binds() returns sorted, side-specific names; SHIFT+Q appears as
LSHIFT+Q and RSHIFT+Q.
SUPER state callback
Section titled “SUPER state callback”hw.on_super(function(pressed) hw.log("debug", pressed and "SUPER pressed" or "SUPER released")end)The callback receives true on press and false on release. A new registration
replaces the previous one.