#!/bin/sh

pgrep -x sxhkd > /dev/null || sxhkd &

# cerritos setup
bspc monitor DP-0 -d 1 2 3 4 5
bspc monitor HDMI-0 -d 6 7 8 9 0

# defiant setup
# bspc monitor eDP-1 -d 1 2 3 4 5

bspc config remove_disabled_monitors false
bspc config remove_unplugged_monitors false

bspc config border_width         2
bspc config window_gap          12

bspc config split_ratio          0.52
bspc config borderless_monocle   true
bspc config gapless_monocle      true

bspc rule -a Lxappearance state=floating
bspc rule -a Nvidia-settings state=floating
bspc rule -a openrgb state=floating
bspc rule -a Sxiv state=floating
bspc rule -a Dconf-editor state=floating
bspc rule -a Thunar state=floating
bspc rule -a Xarchiver state=floating
bspc rule -a L3afpad state=floating
bspc rule -a copyq state=floating
bspc rule -a Xfce4-about state=floating
bspc rule -a GParted state=floating
bspc rule -a Caffeine state=floating

# ----------- #
# environment #
# ----------- #

# set qt to use gtk theme
export QT_QPA_PLATFORMTHEME=gtk2

# --------- #
# autostart #
# --------- #

# screen locker
xset s 600 5
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &

# tailscale systray icon
pgrep -f tailscale-systray > /dev/null || tailscale-systray &

# notifications manager
pgrep -x dunst > /dev/null || dunst &

# notify on song changes
pgrep -x notify.sh > /dev/null || ~/.config/bspwm/scripts/notify.sh &

# polybar
~/.config/bspwm/scripts/launch-polybar.sh &

# clipboard manager
pgrep -x copyq > /dev/null || ~/.config/bspwm/scripts/copyq.sh &

# caffeine
pgrep -x caffeine > /dev/null || caffeine &

# polkit authentication agent
pgrep -x lxsession > /dev/null || lxsession &

# wallpaper
xwallpaper --zoom /home/april/wall/art/police.jpg

# compositor
killall picom
picom --no-fading-openclose &
