#!/bin/sh

if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

# Identify as a non-reparenting window manager
wmname LG3D &

bspc config border_width 2
bspc config window_gap 4

bspc config split_ratio 0.54

bspc config pointer_modifier mod4 # When holding super:
bspc config pointer_action1 move # Left click drag moves
bspc config pointer_action2 resize_corner # Right click drag resizes

bspc config focus_follows_pointer true
bspc config pointer_follows_focus true

bspc config external_rules_command "$(realpath "$(dirname "$0")")/external-rules"

bspc config automatic_scheme alternate

bspc rule -a qutebrowser state=tiled
# bspc rule -a KittyScratch state=floating
bspc rule -a Wrapper-2.0 state=floating # Xfce start menu
bspc rule -a Rofi state=floating

"$(dirname "$0")/colors"
watch_monitors() {
	xfconf-query -c displays -m | while read -r line; do
		bspc-xfce-monitors
	done
}

watch_monitors & # Monitor daemon
pgrep -x sxhkd > /dev/null || sxhkd & # Key daemon
