Hypr Ecosystem/hyprpaper: added example script for multi-monitor setups (#1042)

This commit is contained in:
Owen Wertzberger 2025-04-24 14:07:24 -04:00 committed by GitHub
parent 9b9b8b5375
commit d112ae437e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -150,6 +150,23 @@ WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")"
hyprctl hyprpaper reload ,"$WALLPAPER"
```
For a multiple-monitor setup, you can use this modified script that randomizes the wallpaper of your currently focused monitor:
```bash
#!/usr/bin/env bash
WALLPAPER_DIR="$HOME/wallpapers/"
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)
# Apply the selected wallpaper
hyprctl hyprpaper reload "$FOCUSED_MONITOR","$WALLPAPER"
```
Make sure to change the `WALLPAPER_DIR` to your own wallpaper directory. You can then run this
script in your Hyprland config with a keybind.