swaywm / swaybg

Wallpaper tool for Wayland compositors
MIT License
490 stars 31 forks source link

Add option for swaybg #59

Closed ghost closed 1 year ago

ghost commented 1 year ago

I would like to be able to script the ability to change wallpapers in a time interval. Something like:

while true; do
  for paper in $(shuf -e ~/Pictures/Wallpapers/*); do
    echo "Setting wallpaper: $paper"
    swaybg --output eDP-1 -i "$paper" -m fit
    if [ $? -ne 0 ]; then
      echo "Error setting wallpaper: $paper"
      continue
    fi
    sleep 30
  done
done

Though it seems as though swaybg itself sleeps after execution, therefore making the script pointless. If I could pass an option that would stop swaybg from sleeping, allowing it to change images, I suspect my script would work.

Otherwise, could you please just make an option that can accomplish this within the program itself. Thanks so much.

mstoeckl commented 1 year ago

If I could pass an option that would stop swaybg from sleeping, allowing it to change images, I suspect my script would work.

One way to fix the script is to kill the swaybg process and launch a new one with every image. There are a number of scripts that do this; for one example, see: https://sylvaindurand.org/dynamic-wallpapers-with-sway/ .

Otherwise, could you please just make an option that can accomplish this within the program itself. Thanks so much.

Options to load random images or change the wallpaper at runtime are out of scope for swaybg. (In part because you can emulate them with scripts.)

There are a number of alternative wallpaper programs, some of which are listed at https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway#wallpaper . In particular, https://github.com/danyspin97/wpaperd or https://github.com/Horus645/swww may help you do what you want.

ghost commented 1 year ago

https://sylvaindurand.org/dynamic-wallpapers-with-sway/ << This was pretty useful. The script needed work, but it works. Thanks.