aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfig/hypr/UserScripts/WallpaperAutoChange.sh5
-rwxr-xr-xconfig/hypr/UserScripts/WallpaperSelect.sh4
-rwxr-xr-xconfig/hypr/scripts/RefreshNoWaybar.sh5
-rwxr-xr-xconfig/hypr/scripts/WallustSwww.sh75
-rwxr-xr-xconfig/swaync/config.json4
5 files changed, 58 insertions, 35 deletions
diff --git a/config/hypr/UserScripts/WallpaperAutoChange.sh b/config/hypr/UserScripts/WallpaperAutoChange.sh
index f54620bb..a6d2cedd 100755
--- a/config/hypr/UserScripts/WallpaperAutoChange.sh
+++ b/config/hypr/UserScripts/WallpaperAutoChange.sh
@@ -31,7 +31,10 @@ while true; do
done \
| sort -n | cut -d':' -f2- \
| while read -r img; do
- swww img -o $focused_monitor "$img"
+ swww img -o $focused_monitor "$img"
+ # Regenerate colors from the exact image path to avoid cache races
+ $HOME/.config/hypr/scripts/WallustSwww.sh "$img"
+ # Refresh UI components that depend on wallust output
$wallust_refresh
sleep $INTERVAL
diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh
index a6e6c4d4..a08b53ce 100755
--- a/config/hypr/UserScripts/WallpaperSelect.sh
+++ b/config/hypr/UserScripts/WallpaperSelect.sh
@@ -168,8 +168,8 @@ apply_image_wallpaper() {
swww img -o "$focused_monitor" "$image_path" $SWWW_PARAMS
- # Run additional scripts
- "$SCRIPTSDIR/WallustSwww.sh"
+ # Run additional scripts (pass the image path to avoid cache race conditions)
+ "$SCRIPTSDIR/WallustSwww.sh" "$image_path"
sleep 2
"$SCRIPTSDIR/Refresh.sh"
sleep 1
diff --git a/config/hypr/scripts/RefreshNoWaybar.sh b/config/hypr/scripts/RefreshNoWaybar.sh
index f950db51..8454124e 100755
--- a/config/hypr/scripts/RefreshNoWaybar.sh
+++ b/config/hypr/scripts/RefreshNoWaybar.sh
@@ -31,8 +31,9 @@ done
# quit quickshell & relaunch quickshell
#pkill qs && qs &
-# Wallust refresh
-${SCRIPTSDIR}/WallustSwww.sh &
+# Wallust refresh (synchronous to ensure colors are ready)
+${SCRIPTSDIR}/WallustSwww.sh
+sleep 0.2
# reload swaync
swaync-client --reload-config
diff --git a/config/hypr/scripts/WallustSwww.sh b/config/hypr/scripts/WallustSwww.sh
index 62dde375..5a0bc491 100755
--- a/config/hypr/scripts/WallustSwww.sh
+++ b/config/hypr/scripts/WallustSwww.sh
@@ -1,39 +1,58 @@
#!/bin/bash
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
-# Wallust Colors for current wallpaper
+# Wallust: derive colors from the current wallpaper and update templates
+# Usage: WallustSwww.sh [absolute_path_to_wallpaper]
-# Define the path to the swww cache directory
+set -euo pipefail
+
+# Inputs and paths
+passed_path="${1:-}"
cache_dir="$HOME/.cache/swww/"
+rofi_link="$HOME/.config/rofi/.current_wallpaper"
+wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current"
-# Get a list of monitor outputs
-monitor_outputs=($(ls "$cache_dir"))
+# Helper: get focused monitor name (prefer JSON)
+get_focused_monitor() {
+ if command -v jq >/dev/null 2>&1; then
+ hyprctl monitors -j | jq -r '.[] | select(.focused) | .name'
+ else
+ hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}'
+ fi
+}
-# Initialize a flag to determine if the ln command was executed
-ln_success=false
+# Determine wallpaper_path
+wallpaper_path=""
+if [[ -n "$passed_path" && -f "$passed_path" ]]; then
+ wallpaper_path="$passed_path"
+else
+ # Try to read from swww cache for the focused monitor, with a short retry loop
+ current_monitor="$(get_focused_monitor)"
+ cache_file="$cache_dir$current_monitor"
-# Get current focused monitor
-current_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
-echo $current_monitor
-# Construct the full path to the cache file
-cache_file="$cache_dir$current_monitor"
-echo $cache_file
-# Check if the cache file exists for the current monitor output
-if [ -f "$cache_file" ]; then
- # Get the wallpaper path from the cache file
- wallpaper_path=$(grep -v 'Lanczos3' "$cache_file" | head -n 1)
- echo $wallpaper_path
- # symlink the wallpaper to the location Rofi can access
- if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then
- ln_success=true # Set the flag to true upon successful execution
+ # Wait briefly for swww to write its cache after an image change
+ for i in {1..10}; do
+ if [[ -f "$cache_file" ]]; then
+ break
fi
- # copy the wallpaper for wallpaper effects
- cp -r "$wallpaper_path" "$HOME/.config/hypr/wallpaper_effects/.wallpaper_current"
+ sleep 0.1
+ done
+
+ if [[ -f "$cache_file" ]]; then
+ # The first non-filter line is the original wallpaper path
+ wallpaper_path="$(grep -v 'Lanczos3' "$cache_file" | head -n 1)"
+ fi
fi
-# Check the flag before executing further commands
-if [ "$ln_success" = true ]; then
- # execute wallust
- echo 'about to execute wallust'
- # execute wallust skipping tty and terminal changes
- wallust run "$wallpaper_path" -s &
+if [[ -z "${wallpaper_path:-}" || ! -f "$wallpaper_path" ]]; then
+ # Nothing to do; avoid failing loudly so callers can continue
+ exit 0
fi
+
+# Update helpers that depend on the path
+ln -sf "$wallpaper_path" "$rofi_link" || true
+mkdir -p "$(dirname "$wallpaper_current")"
+cp -f "$wallpaper_path" "$wallpaper_current" || true
+
+# Run wallust (silent) to regenerate templates defined in ~/.config/wallust/wallust.toml
+# -s is used in this repo to keep things quiet and avoid extra prompts
+wallust run -s "$wallpaper_path" || true
diff --git a/config/swaync/config.json b/config/swaync/config.json
index 2ec0f771..0aa1af40 100755
--- a/config/swaync/config.json
+++ b/config/swaync/config.json
@@ -23,7 +23,7 @@
"control-center-width": 450,
"control-center-height": 720,
"keyboard-shortcuts": true,
- "image-visibility": "when available",
+ "image-visibility": "when-available",
"transition-time": 200,
"hide-on-clear": false,
"hide-on-action": true,
@@ -89,4 +89,4 @@
]
}
}
-} \ No newline at end of file
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage