Initial commit of utility scripts

This commit is contained in:
Alex Selimov 2024-12-12 20:16:38 -05:00
parent ac77586a15
commit 1faeefffd7
34 changed files with 1328 additions and 1 deletions

28
bin/wallpaper_randomizer.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
papesdir=$HOME/media/wallpapers/current_rotation
# Kill existing execution if it exists
pgrep -fl wallpaper_randomizer.sh | while read -r line; do
pid=$(echo $line | cut -d " " -f1)
process=$(echo $line | cut -d " " -f2)
if [[ "$pid" != "$$" ]] && [[ "$process" == "wallpaper_rando" ]]; then
kill $pid
fi
done
last_index=""
index=""
while :; do
files=($papesdir/*)
count=$(find -L $papesdir -type f | wc -l)
# Get a new wallpaper
while [ "$index" == "$last_index" ]; do
index=$((($RANDOM % $count)))
done
feh --bg-fill ${files[$index]}
last_index=$index
sleep 15m
done