#! /bin/sh

###
# AUTOSTART
###
xsetroot -cursor_name left_ptr	#fix background cursor being different
sxhkd &
~/.config/polybar/launch.sh &
nitrogen --restore
picom &
dunst &
copyq &
nm-applet &
blueman-applet &
xfce4-power-manager &
numlockx on &
#/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
/usr/bin/lxqt-policykit-agent &

###
# MONITORS
###
if [ "`hostname`" = "beef-book" ]; then
	bspc monitor "DP-1" -d 1 2 3 4 5 6
	bspc monitor "DP-4" -d 1 2 3 4 5 6 7 8 9
	bspc monitor "LVDS1" -d 1 2 3 4 5 6 7 8 9
	bspc monitor "LVDS-1-1" -d 1 2 3 4 5 6 7 8 9
	bspc monitor "VGA-0" 7 8 9
elif [ "`hostname`" = "salad-book" ]; then
	bspc monitor "eDP-1" -d 1 2 3 4 5 6 7 8 9
	bspc monitor "HDMI-0" -d 1 2 3 4 5 6 7 8 9
	bspc monitor "VGA-0" -d 1 2 3 4 5 6 7 8 9
fi

###
# GLOBAL SETTINGS
###
bspc config focus_follows_pointer true
bspc config remove_disabled_monitors true
bspc config remove_unplugged_monitors true
bspc config merge_overlapping_monitors true
bspc config pointer_follows_monitor true

#bspc config bottom_padding	25
#bspc config top_monocle_padding	0
bspc config border_width	2
bspc config window_gap		10 

bspc config split_ratio          0.50
bspc config borderless_monocle   true
bspc config gapless_monocle      true


###
# COLORS
###

# Read colors from Xresources and use them upfront
# I am sorry for how cursed this is

clist=`xrdb -query`
echo "$clist" | while read line
do
	name=$(echo $line | cut -d: -f1)
	color=$(echo $line | cut -d: -f2)
	case "$name" in
		"*.color6")	bspc config active_border_color $color \
				&& bspc config presel_feedback_color $color ;;
		"*.background")	bspc config normal_border_color $color ;;
		"*.foreground")	bspc config focused_border_color $color ;;
	esac
done



#bspc config normal_border_color
#bspc config active_border_color
#bspc config focused_border_color

#bspc config presel_feedback_color

#bspc config normal_sticky_border_color
#bspc config active_sticky_border_color
#bspc config focused_sticky_border_color

#bspc config normal_private_border_color     ""
#bspc config active_private_border_color     ""
#bspc config focused_private_border_color    ""


###
# RULES
###

bspc rule -a Gimp		desktop='^6' state=floating follow=on
bspc rule -a Pavucontrol	state=floating
bspc rule -a copyq		state=floating
bspc rule -a Blueman-manager	state=floating
bspc rule -a Arandr		state=floating
bspc rule -a galculator		state=floating
bspc rule -a Screenkey		manage=off
bspc rule -a Navigator		desktop='^1'
bspc rule -a discord		desktop='^4'
bspc rule -a AlarmWindow	state=floating
bspc rule -a pop-up		state=floating
bspc rule -a setup		state=floating