mirror of
https://github.com/ksyasuda/rice.git
synced 2024-11-22 03:19:58 -08:00
24 lines
523 B
Bash
24 lines
523 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -Eeuo pipefail
|
||
|
|
||
|
dir="/usr/share/wallpapers/"
|
||
|
EXT="/contents/images/1920x1080.jpg"
|
||
|
EXT2="/contents/images/"
|
||
|
count=0
|
||
|
# choose a random directory in wallpapers folder
|
||
|
chosen=$(ls /usr/share/wallpapers | shuf -n 1)
|
||
|
# check to make sure it is a directory
|
||
|
if [[ -d $dir$chosen ]]; then
|
||
|
if [[ -f "$dir$chosen$EXT" ]]; then
|
||
|
feh --bg-scale $dir$chosen$EXT
|
||
|
file=$chosen
|
||
|
else
|
||
|
file=$(ls $dir$chosen$EXT2 | shuf -n 1)
|
||
|
feh --bg-scale $dir$chosen$EXT2$file
|
||
|
fi
|
||
|
echo $file
|
||
|
else
|
||
|
echo 'something went wrong'
|
||
|
fi
|