[autopape.sh]: Add shuffle -s flag
This commit is contained in:
@ -10,12 +10,13 @@ Usage: autopape.sh [OPTIONS]... [ARGUMENTS]...
|
|||||||
Iterate over the files in a directory and set them as the desktop wallpaper at a regular interval.
|
Iterate over the files in a directory and set them as the desktop wallpaper at a regular interval.
|
||||||
Options:
|
Options:
|
||||||
-c Specify the command that should be used to set the wallpaper. Defaults to 'feh --bg-fill'
|
-c Specify the command that should be used to set the wallpaper. Defaults to 'feh --bg-fill'
|
||||||
-h Print this help message
|
|
||||||
-i Specify the interval between wallpaper changes. Defaults to '1m'
|
-i Specify the interval between wallpaper changes. Defaults to '1m'
|
||||||
|
-h Print this help message
|
||||||
|
-s Shuffle the files in the directory for each iteration
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'c:i:h' flag; do
|
while getopts 'c:i:h:s' flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
c)
|
c)
|
||||||
command="${OPTARG}";;
|
command="${OPTARG}";;
|
||||||
@ -27,6 +28,9 @@ while getopts 'c:i:h' flag; do
|
|||||||
usage
|
usage
|
||||||
exit 0;;
|
exit 0;;
|
||||||
|
|
||||||
|
s)
|
||||||
|
files=$(find . -maxdepth 1 -type f | shuf);;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
usage
|
usage
|
||||||
exit 1;;
|
exit 1;;
|
||||||
@ -35,7 +39,11 @@ done
|
|||||||
|
|
||||||
while [ true ]
|
while [ true ]
|
||||||
do
|
do
|
||||||
for img in *
|
if [ -z $files ];then
|
||||||
|
files-$(find . -maxdepth 1 -type f)
|
||||||
|
fi
|
||||||
|
|
||||||
|
for img in $files
|
||||||
do
|
do
|
||||||
eval "$command '$img'"
|
eval "$command '$img'"
|
||||||
sleep "$interval"
|
sleep "$interval"
|
||||||
|
Reference in New Issue
Block a user