Files
hypr-chrome/buildAndLoad.sh
T
2026-07-28 21:22:13 +02:00

25 lines
735 B
Bash
Executable File

#!/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
hyprctl plugin load "$DIR/$NEW_SO"