Unload the config-installed plugin copy in buildAndLoad.sh

The session loads its own copy of the plugin from the Hyprland config, a
separate dlopen with its own decorations - so iterating with a dev build on
top of it drew two frames on every window.

Grep the path back out of $XDG_CONFIG_HOME/hypr rather than hardcoding it:
a home-manager-installed copy lives at a /nix/store path that changes on
every rebuild. -R, since those config files are symlinks into the store.
hyprctl plugin list reports no path, so the config is the only place to
read it from.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 20:36:41 +02:00
co-authored by Claude Opus 5
parent b9dafe2ce1
commit 375cfe1f00
3 changed files with 22 additions and 2 deletions
+15
View File
@@ -21,4 +21,19 @@ for old in hypr-chrome.so hypr-chrome-*.so; do
[ "$old" = "hypr-chrome.so" ] || rm -f "$old"
done
# The session also loads the plugin declaratively from the personal Hyprland
# config (home-manager's wayland.windowManager.hyprland.plugins, which lands
# as a /nix/store/.../lib/libhypr-chrome.so). That copy is a separate dlopen
# with its own decorations, so leaving it loaded means every window gets two
# frames drawn on top of each other. Its store path changes on every rebuild,
# so read it back out of the config instead of hardcoding it (-R to follow
# home-manager's symlinks into the store).
HYPR_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr"
if [ -d "$HYPR_CONFIG_DIR" ]; then
for configured in $(grep -Rho '/[^[:space:]"'"'"']*hypr-chrome[^[:space:]"'"'"']*\.so' "$HYPR_CONFIG_DIR" 2>/dev/null | sort -u || true); do
[ "$configured" = "$DIR/$NEW_SO" ] && continue
hyprctl plugin unload "$configured" >/dev/null 2>&1 || true
done
fi
hyprctl plugin load "$DIR/$NEW_SO"