2019-09-13 10:51:43 +02:00
|
|
|
#!/bin/sh
|
2020-03-27 17:31:53 +01:00
|
|
|
|
2023-10-24 18:58:55 +02:00
|
|
|
# Based on a script by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
|
2020-03-27 17:31:53 +01:00
|
|
|
|
2022-09-08 02:15:11 +02:00
|
|
|
bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/bg"
|
2020-03-27 17:31:53 +01:00
|
|
|
|
|
|
|
|
2022-09-08 02:15:11 +02:00
|
|
|
trueloc="$(readlink -f "$1")" &&
|
|
|
|
case "$(file --mime-type -b "$trueloc")" in
|
|
|
|
image/* ) ln -f "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
|
|
|
inode/directory ) ln -f "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
|
|
|
*) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
xwallpaper --zoom "$bgloc"
|