hyprwm / hyprpaper

Hyprpaper is a blazing fast wayland wallpaper utility with IPC controls.
https://wiki.hyprland.org/Hypr-Ecosystem/hyprpaper/
BSD 3-Clause "New" or "Revised" License
757 stars 54 forks source link

shuffle random wallpaper #194

Open aloispichler opened 2 weeks ago

aloispichler commented 2 weeks ago

To randomly pick (shuffle) a wallpaper out of a set of wallpapers, I had

exec-once=swaybg -i $(shuf -n1 -e /usr/share/backgrounds/xfce/ArchSimple.png /usr/share/backgrounds/xfce/arch2024.jpg /usr/share/backgrounds/xfce/arch2023.jpg /usr/share/backgrounds/xfce/arch10.jpg)

How can this be accomplished with hyprpaper? I want to avoid preloading all.

vaxerski commented 2 weeks ago

edit the config with something like sed and then launch?

jerilMJ commented 1 week ago

Just adding a working example snippet from my config.

$SCRIPTS_DIR/pick_wallpaper.sh:

# Pick random wallpaper
random_pick=$(find "$wp_dir" -type f -name "*.png" -o -name "*.jpg" | shuf -n1)
# Replace the placeholder in template and save to .conf file
sed -e "s~<wp>~${random_pick}~g" $conf_dir/templates/hyprpaper.template > $conf_dir/hyprpaper.conf

$conf_dir/templates/hyprpaper.template:

$wp = <wp>
preload = $wp
wallpaper = , $wp

then just exec-once it

exec-once = $SCRIPTS_DIR/pick_wallpaper.sh && hyprpaper