feat: random wallpapers

This commit is contained in:
2025-07-04 00:31:01 +03:00
parent ce2108ea35
commit 3a8b8f8504
3 changed files with 42 additions and 8 deletions

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
WALLPAPER_DIR="$HOME/Pictures/Wallpapers/current/"
DELAY=5m
random_wallpaper() {
# Check if folder is not empty
if [ -z "$(ls -A "$WALLPAPER_DIR")" ]; then
echo "Current wallpaper folder is empty, nothing to do"
exit 0
fi
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
# Get a random wallpaper that is not the current one
WALLPAPER=$(find "$WALLPAPER_DIR" -type l ! -name "$(basename "$CURRENT_WALL")" | shuf -n 1)
# Apply the selected wallpaper
hyprctl hyprpaper unload all
hyprctl hyprpaper reload ,"$WALLPAPER"
echo "Set random wallpaper to $WALLPAPER"
}
loop() {
while true; do
random_wallpaper
sleep "$DELAY"
done
}
loop