omarchy-remove-gaming-heroic leaves ~/.config/heroic behind ($HOME resolves to /root under pkexec)
Description
omarchy-remove-gaming-heroic removes the Heroic package but leaves the user's
~/.config/heroic (and related) data behind — in my case 2.0 GB of Proton/Wine
runtimes and caches — because the cleanup paths use $HOME, which resolves to
/root (not the invoking user's home) when the script runs under the shell's
privilege escalation.
Environment
- Omarchy:
4.0.2-1 - Kernel:
7.1.9-arch1-2 - Hyprland:
0.56.2 - CPU: Intel Core i7-7920HQ
- GPU: Intel HD 630 + AMD Radeon RX 460/560D (Baffin)
What happened
- Opened the Omarchy shell menu → remove → package → heroic.
- The package
heroic-games-launcher-binwas correctly removed (pacman -Rnssucceeded, confirmed in/var/log/pacman.log). - The script printed "Heroic and its data have been removed", but
~/.config/heroic(2.0 GB) was left on disk, along with~/.local/state/Heroicand~/.cache/heroic_gogdl.
Expected behavior
Removing a package via the menu should also remove that package's user config, caches, and state from the invoking user's home directory, as the script's own summary claims ("Remove Heroic Games Launcher and its game libraries, configs, and caches").
Root cause
/usr/bin/omarchy-remove-gaming-heroic:
set -e
omarchy-pkg-drop heroic-games-launcher-bin
rm -rf \
"$HOME/.config/heroic" \
"$HOME/.local/share/heroic" \
"$HOME/.cache/heroic" \
"$HOME/Games/Heroic"
The script is marked omarchy:requires-sudo=true and is launched by the shell
under pkexec, which sanitizes the environment and sets HOME to the target
user's home (/root) rather than the desktop user's home. The rm -rf therefore
targets /root/.config/heroic (nonexistent) and silently no-ops, while the real
/home/<user>/.config/heroic is never touched.
Evidence this happened (rather than the data being deleted and recreated):
~/.config/heroic/config.jsonmtime: install time (03:52:52)~/.config/heroicdir mtime:03:53:16- package removed at
03:53:47
The directory's mtime predates the removal, so it was never deleted.
Several sibling scripts already handle this correctly by deriving the invoking user, e.g.:
omarchy-apply-lock:target_user=${OMARCHY_INSTALL_USER:-${SUDO_USER:-}}omarchy-nvim-setup/omarchy-nvim-refresh:target_user="${SUDO_USER:-${USER:-root}}"omarchy-upgrade-to-quattro:target_user="${SUDO_USER:-}"
omarchy-remove-gaming-heroic (and likely other omarchy-remove-* scripts) use
bare $HOME and are affected.
Secondary issue
Even with a correct $HOME, the cleanup list is incomplete. It misses:
~/.local/state/Heroic~/.cache/heroic_gogdl
Both of these remained on disk after removal.
Suggested fix
Derive the invoking user's home directory instead of $HOME, e.g.:
target_user="${SUDO_USER:-${USER}}"
user_home=$(getent passwd "$target_user" | cut -d: -f6)
rm -rf "$user_home/.config/heroic" ...
and add the missing ~/.local/state/Heroic and ~/.cache/heroic_gogdl paths.
Steps to reproduce
omarchy install gaming heroic(or installheroic-games-launcher-bin).- Launch Heroic once so
~/.config/heroicis populated. - Menu → remove → package → heroic.
- Observe
~/.config/heroicstill exists after the package is gone.
Thanks for the detailed report. I read it against quattro (988f44e) and v4.0.2.
The $HOME problem is real when the script runs elevated. bin/omarchy-remove-gaming-heroic deletes $HOME/.config/heroic and its siblings, and under sudo or pkexec $HOME is root's. omarchy-pkg-drop still succeeds as root, so the script prints its success message while your data stays where it was. One detail of the diagnosis doesn't match the source, though: the menu entry (remove.gaming.heroic in default/omarchy/omarchy-menu.jsonc) runs the script through omarchy-launch-floating-terminal-with-presentation as you, without pkexec, in both v4.0.2 and quattro. Nothing in bin/omarchy or the shell acts on omarchy:requires-sudo to elevate a command either. Run that way, $HOME is your own. The elevated case is sudo omarchy-remove-gaming-heroic, or pkexec, which the bundled agent skill tells an agent to use when it has no terminal. If you started it from the menu yourself, the path you took isn't one the source explains, and knowing exactly how you ran it would help.
#9571 already fixes the elevated case for this script and nine others in the same family. It resolves the invoking user's home and is linked to close this issue. It is being reviewed as its own item. It does not add ~/.local/state/Heroic or ~/.cache/heroic_gogdl to the cleanup list. I haven't confirmed that Heroic writes those paths, so that part is still open.
I didn't attempt a reproduction for this issue on a worker, since the fix is reviewed and tested in #9571. Claude Opus 5.5 did this review alone. The second opinion (Codex Medium) was reachable but had used up today's review budget, so it did not run. This now waits on the maintainer's decision on #9571.