♻️ refactor(hypr): unified wallpaper script for hyprpaper and swww

This commit is contained in:
Sergio Laín 2025-04-21 18:32:14 +02:00
parent 84ac18bf37
commit cb33a790f2
No known key found for this signature in database
GPG key ID: 51BB28D8B42FB438
5 changed files with 23 additions and 24 deletions

View file

@ -1,5 +1,5 @@
[pyprland] [pyprland]
plugins = ["scratchpads", "magnify", "wallpapers"] plugins = ["scratchpads", "magnify"]
[scratchpads.volume] [scratchpads.volume]
command = "pavucontrol" command = "pavucontrol"

View file

@ -3,10 +3,6 @@
# Automounter for removable media # Automounter for removable media
udiskie & udiskie &
# Wallpaper Backend
hyprpaper &
"$HOME"/.config/hypr/scripts/random_wallpaper_hyprpaper &
# Pyprland Daemon # Pyprland Daemon
pypr --debug /tmp/pypr.log & pypr --debug /tmp/pypr.log &
@ -37,3 +33,8 @@ wl-paste --watch cliphist store &
# Audio # Audio
easyeffects --gapplication-service & easyeffects --gapplication-service &
# Wallpaper Backend
hyprpaper &
# swww-daemon --format xrgb &
"$HOME"/.config/hypr/scripts/random_wallpaper &

View file

@ -0,0 +1,17 @@
#!/usr/bin/bash
WALLPAPER_DIR="$HOME/.config/hypr/theme/walls"
random=$(fd --base-directory "$WALLPAPER_DIR" --type f . | shuf -n 1)
WALLPAPER="$WALLPAPER_DIR/$random"
if pgrep -x "hyprpaper" >/dev/null; then
hyprctl hyprpaper reload ,"$WALLPAPER" && notify-send "Wallpaper Changed" -i "$WALLPAPER" --app-name=Wallpaper
elif pgrep -x "swww" >/dev/null; then
swww img "$WALLPAPER" \
--transition-bezier 0.5,1.19,.8,.4 \
--transition-type wipe \
--transition-duration 2 \
--transition-fps 75 && notify-send "Wallpaper Changed" -i "$WALLPAPER" --app-name=Wallpaper
fi

View file

@ -1,8 +0,0 @@
#!/usr/bin/env bash
WALLPAPER_DIR="$HOME/.config/hypr/theme/walls"
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")" | shuf -n 1)
hyprctl hyprpaper reload ,"$WALLPAPER" && notify-send "Wallpaper Changed" -i "$WALLPAPER" --app-name=Wallpaper

View file

@ -1,11 +0,0 @@
#!/usr/bin/bash
random=$(fd --base-directory "$HOME/.config/hypr/theme/walls/" --type f . | shuf -n 1)
wallpaper="$HOME/.config/hypr/theme/walls/$random"
swww img "$wallpaper" \
--transition-bezier 0.5,1.19,.8,.4 \
--transition-type wipe \
--transition-duration 2 \
--transition-fps 75 && notify-send "Wallpaper Changed" -i "$wallpaper" --app-name=Wallpaper