6
Make waybar stable and reliable (lemmy.frozeninferno.xyz)
submitted 4 months ago* (last edited 3 weeks ago) by communist@lemmy.frozeninferno.xyz to c/linuxquestions@lemmy.zip

So, i'm on hyprland and right now i've setup

exec-once = zsh -c 'sleep 1' && ps aux | rg ' [w]aybar' || while pgrep -f Hyprland > /dev/null ; do (waybar); done

what i need is to add a clause that terminates the "while true; do (waybar); done" that way when the compositor is restarted it kills the previous instance of while true do waybar

Just to break down the reasoning for my current command,

sleep 1 is to prevent certain stupid bugs from occurring that might be fixed now but weren't in the early days

ps aux part is to make sure waybar isn't already running

while pgrep -f Hyprland is SUPPOSED to end the loop when Hyprland ends, but it does not. I don't know why.

The reason for the while loop is to restart waybar if it crashes, but right now, when i restart hyprland (I use wl-restart) the previous while loop doesn't actually close, and waybar binds to the previous hyprlands IPC and I end up with no workspace icons or window names. Any ideas for making this work?

edit: old solution was needlessly complex,

exec-once = pidof waybar > /dev/null || while true ; do (waybar > /dev/null); done

works perfectly!

you are viewing a single comment's thread
view the rest of the comments
[-] ZWQbpkzl@hexbear.net 5 points 4 months ago

This all sounds like you're deep down the wrong path. Have you tried figuring out why waybar is crashing in the first place?

this post was submitted on 21 Jul 2025
6 points (87.5% liked)

Linux Questions

2925 readers
14 users here now

Linux questions Rules (in addition of the Lemmy.zip rules)

Tips for giving and receiving help

Any rule violations will result in disciplinary actions

founded 2 years ago
MODERATORS