27 lines
862 B
Bash
Executable File
27 lines
862 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
IMG="$1"
|
|
|
|
if [[ -f "$IMG" ]]; then
|
|
echo "Changing wallpaper to $IMG"
|
|
echo "$IMG" > "$HOME/.wallpaper"
|
|
hyprctl hyprpaper reload ,"$IMG"
|
|
notify-send -i hyprpaper -u normal "change-wallpaper.sh" "Wallpaper changed to ${IMG##*/variety/}"
|
|
exit 0
|
|
fi
|
|
|
|
WALLPAPER_DIR="$HOME/Pictures/variety/"
|
|
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
|
|
|
|
# Get a random wallpaper that is not the current one
|
|
WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")" ! -name "*.json" | shuf -n 1)
|
|
# remove double slashes that's there for some reason
|
|
WALLPAPER="${WALLPAPER//\/\///}"
|
|
|
|
echo "Changing wallpaper to $WALLPAPER"
|
|
echo "$WALLPAPER" > "$HOME/.wallpaper"
|
|
|
|
# Apply the selected wallpaper
|
|
hyprctl hyprpaper reload ,"$WALLPAPER"
|
|
notify-send -i hyprpaper -u normal "change-wallpaper.sh" "Wallpaper changed to ${WALLPAPER##*/variety/}"
|