OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
hyprland-config low common DISPUTE

Stop autostart apps spawning another copy every time you save hyprland.lua

hyprlandarchomarchy
AUDITED Audited against its sources and confirmed accurate. · checked against Omarchy omarchy 4.0.4-1 on 2026-10-05
AUDIT NOTE

Hyprland v0.56.2 ConfigManager.cpp registers a config watcher whose onChange calls reload(). reload() clears package.loaded for user modules, reinitialises the Lua state and re-runs the whole main config, so top-level code runs again. hl.exec_cmd (LuaBindingsToplevel.cpp) spawns immediately through the executor. hyprland.start fires from the bus start event (LuaEventHandler.cpp), which is not re-emitted on reload. The Arch wiki Hyprland page states that the file is re-parsed on every save and that hl.on("hyprland.start", ...) prevents multiple instances. The autostart wiki page shows the same pattern. The Omarchy branch was checked against /usr/share/omarchy/default/hypr/helpers.lua, where o.launch_on_start wraps hl.on("hyprland.start") and uwsm-app, and ~/.config/hypr/autostart.lua is the shipped home for it. The recovery dispatch uses the 0.56 Lua form. Not exercised: no reload was triggered on this workstation.

Symptom

Each time you save hyprland.lua (or run hyprctl reload) another waybar, nm-applet, notification daemon or terminal appears. After a few edits there are several bars stacked on top of each other and several tray icons.

Cause

Hyprland re-evaluates hyprland.lua on every save and on every reload. In the Lua config there is no exec-once. A bare hl.exec_cmd(...) at the top level of the file is ordinary code, so it runs again on each evaluation. Commands meant to run once must be inside the hyprland.start event, which fires once per session.

Fix

**Plain Arch.** Move every autostart into the start event in ~/.config/hypr/hyprland.lua:


hl.on("hyprland.start", function()
  hl.exec_cmd("waybar")
  hl.exec_cmd("nm-applet")
  -- under uwsm: hl.exec_cmd("uwsm app -- mycommand")
end)

**Omarchy 4.** Put extra autostarts in ~/.config/hypr/autostart.lua with the helper, which wraps hyprland.start for you:


o.launch_on_start("my-service")

Then clear the duplicates already running, for example:


pkill -x nm-applet
hyprctl dispatch 'hl.dsp.exec_cmd("nm-applet")'

Verify

Save hyprland.lua twice, then pgrep -c -x nm-applet (or your app) still prints 1.

Sources

lua-autostart-duplicates-on-every-config-save