Regenerated
This commit is contained in:
+288
-288
File diff suppressed because it is too large
Load Diff
@@ -1,44 +1,34 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# -----------------------------
|
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
||||||
# CONFIGURATION
|
|
||||||
# -----------------------------
|
|
||||||
# Repo path (first argument), fallback to current dir
|
|
||||||
REPO_DIR="${1:-$HOME/myrepo}"
|
|
||||||
SRC_WALLPAPERS="$REPO_DIR/assets/Wallpapers"
|
|
||||||
DST_WALLPAPERS="$HOME/Wallpapers"
|
|
||||||
PICTURES_DIR="$DST_WALLPAPERS/pictures"
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# 2-WAY SYNC (only add/update, never delete)
|
|
||||||
# -----------------------------
|
|
||||||
mkdir -p "$DST_WALLPAPERS"
|
|
||||||
mkdir -p "$PICTURES_DIR"
|
|
||||||
|
|
||||||
# Sync from repo -> home (add/update)
|
|
||||||
rsync -au --ignore-existing "$SRC_WALLPAPERS/" "$DST_WALLPAPERS/"
|
|
||||||
|
|
||||||
# Sync from home -> repo (add only, no deletion)
|
|
||||||
rsync -au --ignore-existing "$DST_WALLPAPERS/" "$SRC_WALLPAPERS/"
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Set random wallpaper per workspace
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Get list of images
|
# Get list of images
|
||||||
|
# -----------------------------
|
||||||
mapfile -t IMAGES < <(find "$PICTURES_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \))
|
mapfile -t IMAGES < <(find "$PICTURES_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \))
|
||||||
|
|
||||||
if [ "${#IMAGES[@]}" -eq 0 ]; then
|
if [ "${#IMAGES[@]}" -eq 0 ]; then
|
||||||
echo "No images found in $PICTURES_DIR"
|
echo "No images found in $PICTURES_DIR"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get number of workspaces (Hyprland / swww)
|
# -----------------------------
|
||||||
NUM_WORKSPACES=$(hyprctl workspaces | wc -l)
|
# Start swww daemon if not running
|
||||||
|
# -----------------------------
|
||||||
|
if ! pgrep -x swww > /dev/null; then
|
||||||
|
echo "Starting swww daemon..."
|
||||||
|
swww daemon &
|
||||||
|
sleep 1 # Give daemon time to start
|
||||||
|
fi
|
||||||
|
|
||||||
for ws in $(seq 1 "$NUM_WORKSPACES"); do
|
# -----------------------------
|
||||||
# Pick a random image
|
# Set a random wallpaper per workspace
|
||||||
|
# -----------------------------
|
||||||
|
WORKSPACES=$(hyprctl workspaces -j | jq -r '.[].id')
|
||||||
|
|
||||||
|
for ws in $WORKSPACES; do
|
||||||
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
||||||
# Set wallpaper for workspace
|
echo "Setting wallpaper for workspace $ws: $RAND_IMAGE"
|
||||||
swww img "$RAND_IMAGE" --no-fade --transition-type none --workspace "$ws"
|
# Each workspace gets its own namespace
|
||||||
done
|
swww img "$RAND_IMAGE" --resize fit --transition-type random --namespace "$ws"
|
||||||
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user