Files
dotfiles/hypr/scripts/random_wallpaper.sh
Nikolai Papin 4e688c7c83 feat: autofreeze script for swww when window is selected + a toggle;
refactor: cpufreq does not save notifications anymore;
feat: 3GHz option for cpufreq;
feat: Script for controlling power profile + bind;
refactor: removed hyprpaper, replaced with swww;
refactor: no longer affecting border radius in gamemode;
fix: grayscale filter;
feat: toggle automatic wallpaper switching;
2025-10-05 15:29:30 +03:00

43 lines
951 B
Bash
Executable File

#!/usr/bin/env bash
WALLPAPER_DIR="$HOME/Pictures/Wallpapers/current/"
INTRO_DIR="$HOME/Pictures/Wallpapers/intro/"
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
swww img -o $1 "$WALLPAPER"
if [ $? -ne 0 ]; then
echo "The previous command failed."
return 1
fi
echo "Set random wallpaper for $1 to $WALLPAPER"
}
loop() {
sleep 1
while true; do
if [ ! $(cat $HOME/.config/hypr/conditions/lock_wallpaper) -eq 1 ]; then
random_wallpaper "eDP-1" &
sleep 1
random_wallpaper "HDMI-A-1" &
fi
sleep "$DELAY"
done
}
loop