From dfc806591546e44b8608dace7fa7a379a5954e74 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Wed, 20 May 2026 18:19:14 -0400 Subject: [PATCH] Clear cached omarchy Lua modules on hyprctl reload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- config/hypr/hyprland.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua index 6836e3cc..30eafe11 100644 --- a/config/hypr/hyprland.lua +++ b/config/hypr/hyprland.lua @@ -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;"