feat: random wallpapers
This commit is contained in:
32
hypr/scripts/random_wallpaper.sh
Executable file
32
hypr/scripts/random_wallpaper.sh
Executable 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
|
||||
Reference in New Issue
Block a user