swaywm / swaybg

Wallpaper tool for Wayland compositors
MIT License
517 stars 32 forks source link

Swaybg opens new process instead of using existing process #74

Closed Zedai00 closed 5 months ago

Zedai00 commented 5 months ago

I don't know how it works but when run swaybg then wallpapers changes and then again I start swaybg in another terminal then the wallpaper is set again but when I kill it. The previous wallpaper comes back so I think that swaybg opens new process everytime it runs. what I want is to replace the current process instead of opening new one

mstoeckl commented 5 months ago

When multiple instances of swaybg are run for an output, their images will be stacked on top of each other and only one will be visible. Setting the background in Sway will run a swaybg process, so its image will be in the stack until the process is killed.

so I think that swaybg opens new process everytime it runs.

Yes. If you want to change wallpapers at runtime, either reload the config in Sway (making it kill and reload its swaybg instance); or explicitly kill the old swaybg instance, using e.g the command. killall swaybg, and then start a new one.

(If your end goal is to periodically rotate between wallpapers, you may be better served with wallpaper programs like https://github.com/LGFae/swww or https://github.com/danyspin97/wpaperd; see https://github.com/swaywm/sway/wiki/Useful-add-ons-for-sway#wallpaper for a list.)