26 lines
786 B
Bash
Executable File
26 lines
786 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
PICTURES_DIR="$HOME/Wallpapers/pictures"
|
|
|
|
# -----------------------------
|
|
# Get list of images
|
|
# -----------------------------
|
|
mapfile -t IMAGES < <(find "$PICTURES_DIR" -type f \( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' \))
|
|
if [ "${#IMAGES[@]}" -eq 0 ]; then
|
|
echo "No images found in $PICTURES_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# -----------------------------
|
|
# Set a random wallpaper per workspace
|
|
# -----------------------------
|
|
WORKSPACES=$(hyprctl workspaces -j | jq -r '.[].id')
|
|
|
|
for ws in $WORKSPACES; do
|
|
RAND_IMAGE="${IMAGES[RANDOM % ${#IMAGES[@]}]}"
|
|
echo "Setting wallpaper for workspace $ws: $RAND_IMAGE"
|
|
# Set wallpaper for workspace
|
|
swww img "$RAND_IMAGE" --resize fit --transition-type random --namespace "$ws"
|
|
done
|