From ab123d118d268d4927b585e4b1102f97b5538d0b Mon Sep 17 00:00:00 2001 From: garhve Date: Sun, 8 Jun 2025 18:15:17 +0800 Subject: add randomize wallpaper script --- randomize_hyprpaper.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 randomize_hyprpaper.sh (limited to 'randomize_hyprpaper.sh') diff --git a/randomize_hyprpaper.sh b/randomize_hyprpaper.sh new file mode 100755 index 0000000..a8457d5 --- /dev/null +++ b/randomize_hyprpaper.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env sh + +###################################################################### +# @author : pico (pico@$HOSTNAME) +# @file : randomize_hyprpaper +# @created : Sunday Jun 08, 2025 18:03:22 CST +# +# @description : +###################################################################### + +WALLPAPER_DIR="$HOME/data/pictures/wallpaper/" +CURRENT_WALL=$(hyprctl hyprpaper listloaded) + +# Get the name of the focused monitor with hyprctl +FOCUSED_MONITOR=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') + +# Get a random wallpaper that is not the current one +WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")" | shuf -n 1) + +hyprctl hyprpaper reload "$FOCUSED_MONITOR","$WALLPAPER" -- cgit v1.2.3-70-g09d2