Idle Inhibitor Active on Startup

- Make killall waybar fail silently if waybar
  isn't already running
- Update launch script to run in foreground
- Use verbose version of waybar CLI args
- Automatically restart waybar if it exits
  with non 143 (SIGTERM) exit code so random
  crashes (e.g., when opening LibreOffice or
  some games) don't persist and bar gets
  restarted
This commit is contained in:
Sravan Balaji
2024-12-29 13:46:32 -05:00
parent fcee83d388
commit 81bb55f185
3 changed files with 28 additions and 10 deletions

View File

@@ -595,11 +595,20 @@ static const Button buttons[] = {
** Launch Script ** Launch Script
#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle waybar/launch.sh #+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle waybar/launch.sh
killall waybar killall waybar || true
/usr/bin/waybar \ until /usr/bin/waybar \
-c $HOME/.config/dwl/waybar/config.jsonc \ --config $HOME/.config/dwl/waybar/config.jsonc \
-s $HOME/.config/dwl/waybar/style.css & --style $HOME/.config/dwl/waybar/style.css;
do
if [ $? -ne 143 ]; then
echo "Dwl Waybar stopped with exit code $?. Respawning..." >&2;
sleep 1;
else
echo "Dwl Waybar manually killed with SIGTERM";
break;
fi
done
#+END_SRC #+END_SRC
** Start Configuration ** Start Configuration
@@ -979,7 +988,7 @@ fi
"tooltip": true, "tooltip": true,
"tooltip-format-activated": "Idle Inhibitor: {status}", "tooltip-format-activated": "Idle Inhibitor: {status}",
"tooltip-format-deactivated": "Idle Inhibitor: {status}", "tooltip-format-deactivated": "Idle Inhibitor: {status}",
"start-activated": false, "start-activated": true,
}, },
#+END_SRC #+END_SRC

View File

@@ -177,7 +177,7 @@
"tooltip": true, "tooltip": true,
"tooltip-format-activated": "Idle Inhibitor: {status}", "tooltip-format-activated": "Idle Inhibitor: {status}",
"tooltip-format-deactivated": "Idle Inhibitor: {status}", "tooltip-format-deactivated": "Idle Inhibitor: {status}",
"start-activated": false, "start-activated": true,
}, },
"memory": { "memory": {

View File

@@ -1,6 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
killall waybar killall waybar || true
/usr/bin/waybar \ until /usr/bin/waybar \
-c $HOME/.config/dwl/waybar/config.jsonc \ --config $HOME/.config/dwl/waybar/config.jsonc \
-s $HOME/.config/dwl/waybar/style.css & --style $HOME/.config/dwl/waybar/style.css;
do
if [ $? -ne 143 ]; then
echo "Dwl Waybar stopped with exit code $?. Respawning..." >&2;
sleep 1;
else
echo "Dwl Waybar manually killed with SIGTERM";
break;
fi
done