Regenerated

This commit is contained in:
2026-03-29 13:50:57 +00:00
parent 85e28303be
commit 604c6bbcb4
5 changed files with 294 additions and 318 deletions
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
# Determine repo root dynamically
repoRoot="$(dirname "$(readlink -f "$0")")/../.."
wallpaperSrc="$repoRoot/assets/Wallpapers"
wallpaperDst="$HOME/Wallpapers"
mkdir -p "$wallpaperDst"
# 2-way sync (add only, overwrite if newer, never delete)
rsync -au --ignore-existing "$wallpaperSrc/" "$wallpaperDst/"
rsync -tu "$wallpaperDst/" "$wallpaperSrc/"
# Gather wallpapers
mapfile -t wallpapers < <(find "$wallpaperDst" -type f)
numWallpapers=${#wallpapers[@]}
if [[ $numWallpapers -eq 0 ]]; then
echo "No wallpapers found in $wallpaperDst"
exit 1
fi
# Check if a workspace ID is passed
if [[ $# -eq 1 ]]; then
ws="$1"
randomIndex=$(( RANDOM % numWallpapers ))
swww img "${wallpapers[$randomIndex]}" --transition-fade 1 --workspace "$ws"
else
# Full refresh for all workspaces
workspaces=$(hyprctl workspaces -j | jq -r '.[].id')
for ws in $workspaces; do
randomIndex=$(( RANDOM % numWallpapers ))
swww img "${wallpapers[$randomIndex]}" --transition-fade 1 --workspace "$ws"
done
fi