diff --git a/config/herbstluftwm/autostart b/config/herbstluftwm/autostart index 08ebb90..41a48d5 100755 --- a/config/herbstluftwm/autostart +++ b/config/herbstluftwm/autostart @@ -189,10 +189,24 @@ herbstclient set tree_style '╾│ ├└╼─┐' # or simply: # hc detect_monitors -# find the panel -panel=~/.config/herbstluftwm/panel.sh -[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh -for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do - # start it on each monitor - "$panel" $monitor & -done +# add external panel +{ + # find the panel + panel=~/.config/herbstluftwm/panel.sh + [ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh + + # initialize array to store panel-pids + pids=( ) + + # start panel on every monitor + for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do + # start it on each monitor and save pids + "$panel" $monitor & + pids+=( $! ) + done + + # wait until the panels should be stopped + herbstclient -w '(quit_panel|reload)' + # stop all started panels + kill ${pids[@]} +} &