omarchy-hook double-runs .d/ hooks, breaking theme-set variable exports
omarchy-hook runs both the parent hook (~/.config/omarchy/hooks/
Result: hooks like 40-steam.sh that use ${rgb_normal_blue} etc. produce empty CSS so steam renders as broken depp-black ui
reproduction:
- set any theme: omarchy theme set
- check ~/.local/share/steam-adwaita/adwaita/colorthemes/omarchy/omarchy.css
- all --adw-*-rgb: values are empty (e.g. --adw-accent-bg-rgb: !important;)
In bin/omarchy-hook, the parent hook runs first (which exports vars and runs .d/ hooks), then omarchy-hook also runs the .d/ hooks in new bash processes without those exports, overwriting the good CSS.
Fix: skip the .d/ loop when a parent hook exists, since the parent already handles its children, we can just change the second if to elif.
Omarchy 3.8.2, commit 8e031516.
I've opened a draft PR to address this here: #6062
Confirmed in bin/omarchy-hook. The script runs the parent hook and then also iterates the .d/ directory itself:
if [[ -f $HOOK_PATH ]]; then
bash "$HOOK_PATH" "$@" || echo "Hook failed: $HOOK_PATH"
fi
if [[ -d $HOOK_DIR ]]; then
for hook in "$HOOK_DIR"/*; do
...
bash "$hook" "$@" # re-runs the same .d/ scripts in a fresh bash
done
fi
For theme-set, the parent script already loops over theme-set.d/*.sh and passes the exported rgb_* color variables to each child. omarchy-hook then re-invokes those same .d/ scripts in fresh bash processes with no exported colors, so hooks like 40-steam.sh emit empty --adw-*-rgb: values and Steam renders black.
So the .d/ scripts effectively run twice, and the second (variable-less) run wins by overwriting the output. Reproduced the empty-CSS symptom you describe. The fix is for omarchy-hook to not re-run .d/ when the parent hook already owns that iteration (or for the parent to stop iterating and let omarchy-hook be the single runner, exporting the vars).
I reproduced this on a fresh Omarchy worker at current quattro (902fd8aeb), and the mechanism is as you describe. bin/omarchy-hook runs the flat ~/.config/omarchy/hooks/theme-set and then, separately, every script in theme-set.d/. The flat theme-set from imbypass/omarchy-theme-hook exports the rgb_* colours and runs theme-set.d/*.sh itself. So each of its scripts runs twice, and the second run, which has no colours, overwrites the CSS: with a stand-in for that hook and 40-steam.sh, the script ran twice and wrote --adw-accent-bg-rgb: !important;.
The elif change fixes that case (one run, colours present), but it also changes behaviour Omarchy documents. The hooks guide says scripts in <name>.d/ are independent and that a flat <name> file runs first, and omarchy hook install puts scripts in .d/. On the same worker, a plain flat theme-set next to an independent theme-set.d/notify runs both today. With elif, only the flat file runs and the .d/ script silently stops. #6062 made the same change and was closed. ./test/cli passes at quattro.
So the double run comes from the theme hook project using Omarchy's own theme-set.d/ as its private directory, not from a defect in the runner on its own. The fix that changes nothing for anyone else belongs in that project: keep its dependent scripts in a directory of its own, or have each script set up its own colours. Its issue imbypass/omarchy-theme-hook#55 reports this double run, plus a second Omarchy 4 problem: theme-set reads colors.toml from a path that no longer exists, so its colours are empty even when a script runs only once. An Omarchy-side change alone would not bring the Steam theme back on 4.x.
Codex at medium effort reviewed the issue and the source independently and reached the same conclusion: the mechanism is real, elif would be a behaviour change rather than a contained fix, and the fix belongs in the third-party project. It also suggested the hooks guide could say plainly that a flat hook neither owns .d/ dispatch nor passes its environment to those scripts. Whether Omarchy should change how it dispatches hooks, or document this, is the maintainer's call, so no fix PR is open and this waits on them.