Initial commit of utility scripts
This commit is contained in:
parent
ac77586a15
commit
1faeefffd7
34 changed files with 1328 additions and 1 deletions
28
bin/wallpaper_randomizer.sh
Executable file
28
bin/wallpaper_randomizer.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue