Clear cached omarchy Lua modules on hyprctl reload

Lua's require() caches modules in package.loaded; without explicit
invalidation, changes to default/hypr/*.lua or ~/.config/hypr/*.lua
won't take effect after hyprctl reload even though hyprland.lua itself
re-runs.

The clear runs unconditionally — benefits both dev-link workflows
(checkout files re-evaluate after every reload) and normal users who
edit their own ~/.config/hypr/*.lua and run omarchy-restart-hyprctl.
Cost is negligible: package.loaded has a handful of entries.

Pattern matches the require_all.lua reload option (which sets
package.loaded[module] = nil before require()), but applied broadly to
the omarchy module namespace at the entry point so individual modules
don't need to opt in.
This commit is contained in:
Ryan Hughes
2026-06-04 18:34:35 -04:00
parent 7e7a665663
commit dfc8065915
+11
View File
@@ -1,5 +1,16 @@
-- Learn how to configure Hyprland: https://wiki.hypr.land/Configuring/Start/
-- Force re-evaluation of Omarchy modules on every hyprctl reload. Lua caches
-- already-required modules in package.loaded, so without this clear, changes
-- to default/hypr/*.lua (and user ~/.config/hypr/*.lua) in a checkout wouldn't
-- take effect after `hyprctl reload` even though hyprland.lua re-runs.
-- Cheap: package.loaded is small.
for k in pairs(package.loaded) do
if k:match("^default%.hypr") or k:match("^hypr%.") then
package.loaded[k] = nil
end
end
-- Load user modules from ~/.config and Omarchy defaults from $OMARCHY_PATH.
package.path = os.getenv("HOME")
.. "/.config/?.lua;"