minor fix

This commit is contained in:
sankalp committed 2023-12-31 08:53:37 +05:45
1 parent 7286c99e90
commit a5b23da5bf
11 files changed
+108 -65

No files matched your search

+20 -20
View File
@@ -2,34 +2,34 @@
DIR="$HOME/Pictures/wallpapers/"
PICS=($(find "${DIR}" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \)))
RANDOMPICS=${PICS[$RANDOM % ${#PICS[@]}]}
# Create symbolic link to the selected wallpaper
ln -sf "${RANDOMPICS}" "$HOME/.config/hypr/.current_wallpaper"
# Check if swww is initialized
swww query || swww init
# Set the wallpaper
swww img "$HOME/.config/hypr/.current_wallpaper"
if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then
# Check if there are wallpapers in the specified directory
if [ ${#PICS[@]} -eq 0 ]; then
echo "No wallpapers found in ${DIR}. Exiting."
exit 1
fi
# Check if swww is initialized, and initialize if not
swww query || swww init
# Set the transition type to random
export SWWW_TRANSITION_TYPE=random
# This controls (in seconds) when to switch to the next image
INTERVAL=1800
while true; do
find "$1" -type f \
| shuf \
| while read -r img; do
# Update the symbolic link to the new wallpaper
ln -sf "$img" "$HOME/.config/hypr/.current_wallpaper"
# Set the new wallpaper
swww img "$HOME/.config/hypr/.current_wallpaper"
sleep $INTERVAL
done
# Select a random wallpaper
RANDOMPICS=${PICS[$RANDOM % ${#PICS[@]}]}
# Create symbolic link to the selected wallpaper
ln -sf "${RANDOMPICS}" "$HOME/.config/hypr/.current_wallpaper"
# Set the new wallpaper
swww img "$HOME/.config/hypr/.current_wallpaper"
# Notify that wallpaper has changed
notify-send "Wallpaper Changed" -i "$RANDOMPICS"
sleep $INTERVAL
done