summaryrefslogtreecommitdiff
path: root/randomize_hyprpaper.sh
blob: a8457d5b96d92130af2e2284d737745429742b87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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"