#!/usr/bin/env bash set -e DIR="/mnt/hdd_01/data/Dev/repos/hypr-chrome" cd "$DIR" cmake -B build -S . cmake --build build # Hyprland's plugin loader never fully unmaps a .so once dlopen'd - reloading # the same path just serves the old (possibly deleted/stale) mapping instead # of the freshly built one. Loading a uniquely-named copy each time forces a # real reload. UID_SUFFIX=$(od -An -N4 -tx4 /dev/urandom | tr -d ' \n') NEW_SO="hypr-chrome-${UID_SUFFIX}.so" cp hypr-chrome.so "$NEW_SO" for old in hypr-chrome.so hypr-chrome-*.so; do [ "$old" = "$NEW_SO" ] && continue hyprctl plugin unload "$DIR/$old" >/dev/null 2>&1 || true [ "$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"