Just do an infinite loop
exec_once = zsh -c 'while true; do waybar; done'
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
Just do an infinite loop
exec_once = zsh -c 'while true; do waybar; done'
This is so ridiculous, I fucking love it. I just have waybar bound to a hotkey, but this solution is truly amazing
Just make a user systemd unit if one doesn't already exist, set to relaunch on failure, then all set.
Same problem here, this is my solution:
exec-once = bash -c 'until waybar; do echo "Waybar crashed with exit code $?. Respawning..." >&2; done'
Ok firstly that's hilarious. Secondly I'm pretty sure &&
means "execute the second thing if the first thing exits with code 0" so if waybar is segfaulting it shouldn't execute any of the other waybars; if you were to do it this way (while true or a systemd service as suggested in the comments makes more sense) a semicolon would probably make sense?
Yeah I noticed it wasn't actually working and for some reason assumed that it was because it crashed so many times that I ran out of waybars, so I added a million after that, and you're totally right, I know better than that, thanks!
I thought && only proceeded to the next statement if the first did not crash
I guess waybar still returns 0 on segfault. Seems weird.
Nah I just noticed it crashed anyway and didn't assume it was a flaw in my methodology but rather that i ran out of waybars queue'd
Yeah you would need to use a ; instead of &&
I think OPs solution is fucking hilarious
Have you tried using the latest git version of Waybar? They fixed a segfault a few days ago which might be the same one you're facing.
...that does indeed look very similar, but my solution makes it so that if waybar crashes it doesn't even matter, which I quite like, even if the segfault has been fixed.
I would install a systemd user service with the setting Restart=always
. If your window manager is started with systemd, or defines a systemd target you can configure the waybar service to start and stop automatically with the window manager.
while true; do waybar; done
😬 😄
Thank you!
What about a while loop?