#!/usr/bin/env bash

CFGDIR=$HOME/.config/herbstluftwm

# kill old instances, perhaps I should do this with pids?
pkill dzen2
pkill lemonbar
pkill stalonetray
pkill conky
pkill urxvtd
pkill udiskie

herbstclient emit_hook reload

${CFGDIR}/bindings.sh
${CFGDIR}/rules.sh
${CFGDIR}/styling.sh

herbstclient set tree_style '╾│ ├└╼─┐'
herbstclient unlock
herbstclient detect_monitors

panel_height=20
statusbar_height=20

for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
    # start it on each monitor
    herbstclient pad $monitor $panel_height 0 $statusbar_height 0
    ${CFGDIR}/panel.sh $monitor &
    ${CFGDIR}/statusbar.sh $monitor &
done

${CFGDIR}/tray.sh &

urxvtd &
udiskie --tray &
systemctl --user restart sxhkd
systemctl --user restart xautolock

wmname LG3D
