setbg can take directory arg for random

This commit is contained in:
Luke Smith 2020-03-15 18:10:59 -04:00
parent a2e0d2441b
commit db46b82f7f
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -4,8 +4,13 @@
# script, if given an argument, moves it there. This script without an # script, if given an argument, moves it there. This script without an
# argument sets ~/.config/wall.png as the wallpaper, which is required on login # argument sets ~/.config/wall.png as the wallpaper, which is required on login
# if you don't want a black screen. # if you don't want a black screen.
#
# You may also give a directory name to select a random image from that
# directory as a wallpaper. Be careful that the directory only has images.
[ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." [ -f "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed."
[ -d "$1" ] && mv "$(find "$1" -type f | shuf -n 1)" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Random Wallpaper chosen."
# If pywal is installed, use it. # If pywal is installed, use it.
type wal >/dev/null 2>&1 && { wal -c ; type wal >/dev/null 2>&1 && { wal -c ;