in my config file exists…

exec-once = zsh -c 'sleep 1' && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar && waybar

Why? Because waybar crashes sometimes when I turn my monitor off/on, I documented this here: https://github.com/Alexays/Waybar/issues/3047

…this opens waybar if it crashes… and if that crashes, it opens another waybar, and you’ll notice, if that one crashes, it opens another one… now you may have seen the pattern here but in case you didn’t, that one will then lead to another waybar…

Is there a less ridiculous way of making waybar open every time when waybar crashes, giving me better fault tolerance?

  • @communism@lemmy.ml
    link
    fedilink
    431 year ago

    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?

    • CommunistOP
      link
      fedilink
      English
      211 year ago

      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!

  • hallettj
    link
    fedilink
    English
    321 year ago

    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.

  • x3i
    link
    fedilink
    201 year ago

    Same problem here, this is my solution:

    exec-once = bash -c 'until waybar; do echo "Waybar crashed with exit code $?.  Respawning..." >&2; done'
    
    
    • Shadow
      link
      fedilink
      61 year ago

      I guess waybar still returns 0 on segfault. Seems weird.

      • CommunistOP
        link
        fedilink
        English
        71 year ago

        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

    • CommunistOP
      link
      fedilink
      English
      81 year ago

      …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.

  • Tempy
    link
    fedilink
    181 year ago

    Just do an infinite loop

    exec_once = zsh -c 'while true; do waybar; done'

  • Eevoltic [she/her]
    link
    fedilink
    English
    171 year ago

    This is so ridiculous, I fucking love it. I just have waybar bound to a hotkey, but this solution is truly amazing