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.
This commit is contained in:
Thomas Preisner 2017-11-11 22:29:37 +01:00
parent f7a6dddd7b
commit 66efcc883e

View file

@ -189,10 +189,24 @@ herbstclient set tree_style '╾│ ├└╼─┐'
# or simply:
# hc detect_monitors
# 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
# 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[@]}
} &