diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-01-06 23:38:57 -0500 |
|---|---|---|
| committer | Don Williams <don.e.williams@gmail.com> | 2026-01-06 23:38:57 -0500 |
| commit | 36848b869cdf753f716c88b1a2bdc8e482434ae2 (patch) | |
| tree | 7028de428fb810a2a8ec123a9a317da10a8991cc | |
| parent | 5d4fb9d343b0bebd6fd56a1668fe2e8ebafc891d (diff) | |
Possible race condition now waits then refreshes
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: hypr/scripts/ThemeChanger.sh
| -rwxr-xr-x | config/hypr/scripts/ThemeChanger.sh | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/config/hypr/scripts/ThemeChanger.sh b/config/hypr/scripts/ThemeChanger.sh index 1ae1060f..a40a1f18 100755 --- a/config/hypr/scripts/ThemeChanger.sh +++ b/config/hypr/scripts/ThemeChanger.sh @@ -39,14 +39,30 @@ if wallust theme -- "${choice}"; then -h string:x-dunst-stack-tag:themechanger \ "Global theme changed" "Selected: ${choice}" - # Give wallust a brief moment to finish writing templates - sleep 0.15 + # Regenerate templates from the current wallpaper to ensure Wallust rewrites waybar/rofi files + start_ts=$(date +%s) + wp_cur="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" + if [ -f "$wp_cur" ]; then + wallust run -s "$wp_cur" >/dev/null 2>&1 || true + fi + + # Wait until template targets exist and are non-empty/newer than the start time + targets=("$HOME/.config/waybar/wallust/colors-waybar.css" "$HOME/.config/rofi/wallust/colors-rofi.rasi") + for i in $(seq 1 40); do + ok=1 + for f in "${targets[@]}"; do + if [ ! -s "$f" ]; then ok=0; break; fi + mtime=$(stat -c %Y "$f" 2>/dev/null || echo 0) + if [ "$mtime" -lt "$start_ts" ]; then ok=0; break; fi + done + [ $ok -eq 1 ] && break + sleep 0.1 + done - # Prefer the same refresh path used by WallpaperSelect to avoid CSS race/fallbacks + # Refresh bars/menus after files are in place if [ -x "$HOME/.config/hypr/scripts/Refresh.sh" ]; then "$HOME/.config/hypr/scripts/Refresh.sh" >/dev/null 2>&1 || true else - # Fallback: reload Waybar only if command -v waybar-msg >/dev/null 2>&1; then waybar-msg cmd reload >/dev/null 2>&1 || true else |
