#!/bin/sh

. ~/.bin/_config

# export MIXERDEVICE=/dev/audioctl0
# pgrep -q polybar || polybar &

# start hotkey daemon
pgrep -q sxhkd || sxhkd -c $HOME/.config/bspwm/sxhkdrc &
pgrep -qf bspswallow || bspswallow &

# we're fancy now.
# hsetroot -fill ~/Backgrounds/5JdtbnY.jpg
# pgrep -q picom || picom &

xsetroot -solid "$BACKGROUND"

# configure bspwm
bspc monitor -d 1 2 3 4 5 6 7 8 9 10

bspc config border_width            2
bspc config window_gap              26

remove_disabled_monitors            true
remove_unplugged_monitors           true

bspc config split_ratio             0.50
bspc config focus_follows_pointer   true

bspc config borderless_monocle      false
bspc config gapless_monocle         true

bspc config focused_border_color    "$COLOR_NF"
bspc config active_border_color     "$COLOR_NF"
bspc config normal_border_color     "$COLOR_NB"
bspc config ignore_ewmh_fullscreen  true

bspc config presel_feedback_color   "$COLOR_SB"
bspc config presel_feedback         true

# automatic tiling
bspc config automatic_scheme        alternate
bspc config honor_size_hints        false

# mouse can resize/move floating nodes
bspc config pointer_modifier        mod1
bspc config pointer_action1         move
bspc config pointer_action2         resize_corner

RES=$(xrandr | grep "*+" | awk '{print $1}')
GAP=150
H=$(( ${RES%x*} - 2 * GAP ))
V=$(( ${RES#*x} - 2 * GAP ))

bspc rule -a mpv:floatmpv   sticky=on state=floating rectangle=$GAP,$GAP,$H,$V
bspc rule -a Screenkey      manage=off
bspc rule -a scratchpad     sticky=on state=floating rectangle=$GAP,$GAP,$H,$V
bspc rule -a xconsole     sticky=on state=floating rectangle=$GAP,$GAP,$H,$V


