summaryrefslogtreecommitdiff
path: root/randomize_hyprpaper.sh
diff options
context:
space:
mode:
authorgarhve <git@garhve.com>2025-06-08 18:15:17 +0800
committergarhve <git@garhve.com>2025-06-08 18:15:17 +0800
commitab123d118d268d4927b585e4b1102f97b5538d0b (patch)
treeb687439d8312dde1d078632c5ddab702248acbfd /randomize_hyprpaper.sh
parent645463dbfbbbeb358b42ac877744ac161843c6ac (diff)
add randomize wallpaper script
Diffstat (limited to 'randomize_hyprpaper.sh')
-rwxr-xr-xrandomize_hyprpaper.sh20
1 files changed, 20 insertions, 0 deletions
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"