From 66efcc883e7fac63cb073f85f1e4a5a209747598 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 11 Nov 2017 22:29:37 +0100 Subject: [PATCH] herbstluftwm: improve panel startup and add autokill-hooks Save pids of each panel in order to kill each process in case of herbstluftwm restart/reload. --- config/herbstluftwm/autostart | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) 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[@]} +} &