| 1 | #!/bin/sh |
| 2 | # Start the polybar bar defined in ./config.ini (installed at |
| 3 | # ~/.config/polybar/config.ini), replacing any bar already running. |
| 4 | # |
| 5 | # There is one bar window, spanning the screen and fully transparent; the |
| 6 | # visible islands are built inside it out of modules (see modules/caps.ini). |
| 7 | # |
| 8 | # Meant to be run as the XFCE session client that used to be xfce4-panel — |
| 9 | # see ../xfce/polybar-panel.sh, which does that swap. |
| 10 | set -u |
| 11 | |
| 12 | # Ask a running polybar to quit over IPC, falling back to a signal. |
| 13 | polybar-msg cmd quit >/dev/null 2>&1 || pkill -u "$(id -u)" -x polybar |
| 14 | |
| 15 | # Wait for it to actually let go of the bar window before claiming it. |
| 16 | i=0 |
| 17 | while pgrep -u "$(id -u)" -x polybar >/dev/null 2>&1 && [ "$i" -lt 20 ]; do |
| 18 | sleep 0.2 |
| 19 | i=$((i + 1)) |
| 20 | done |
| 21 | |
| 22 | polybar main & |
| 23 | |
| 24 | # Stay alive as the session client for as long as the bar is up. polybar |
| 25 | # re-execs in place on `polybar-msg cmd restart`, so this PID survives it. |
| 26 | wait |