Skip to content

Configuration

HyprWin executes hyprwin.lua at startup.

hyprwin.lua
hw.settings = {
border = 3,
move_preview = "overlay",
resize_preview = "overlay",
}
hw.bind("Q", function()
local window = hw.window.at_cursor()
if window and window:responsive() then
window:close()
end
end)

Every load creates a new Lua state. Bindings, timers, callbacks, and Lua globals from the previous state are discarded. The complete configuration is then executed again.

  • Select Reload Config from the tray menu.
  • Call hw.reload() from a binding or timer.

hw.reload() is ignored during initial configuration execution and inside reload or exit lifecycle callbacks. If SUPER is currently held, a requested reload is deferred until SUPER is released.

See hw for reload and exit callbacks.

A syntax error or uncaught runtime error during configuration execution enters safe mode:

  • Lua bindings are cleared.
  • Lua timers and callbacks are removed.
  • Settings return to their defaults.
  • The error is shown in a message box and written to the log.

Fix hyprwin.lua, then select Reload Config to recover. Binding and timer errors are logged without entering safe mode.

See Logging to open the log or write messages from Lua.

The active configuration directory is added to Lua’s module search path, so split configs can use normal require calls:

hyprwin.lua
require("bindings")
require("audio")

Example layout:

  • DirectoryHyprWin
    • hyprwin.exe
    • lua51.dll
    • hyprwin.lua configuration entry point
    • bindings.lua
    • audio.lua

Place .luarc.json and hw_annotations.lua in the folder opened by your editor. The supplied .luarc.json configures Lua Language Server for LuaJIT and loads the HyprWin annotations as a workspace library.