#!/bin/sh
###== Function
R() {
  if ! pgrep $1
     then $@& fi
}

###== Autostart
R feh --randomize --bg-scale ~/Pictures/wallp &
R sxhkd -c ~/.config/bspwm/sxhkd &
R lxsession &
R picom -b &
~/.config/bspwm/polybar/bar.sh &

###== BSPWM

# Workspaces
bspc monitor -d 1 2 3 4 5 6 7 8 9

# General
bspc config border_width           2
bspc config window_gap             6
bspc config split_ratio            0.50
bspc config borderless_monocle     true
bspc config gapless_monocle        true
bspc config single_monocle         true
bspc config focus_follows_pointer  true

# Colors
bspc config normal_border_color   "#262A2B"
bspc config active_border_color   "#1F2324"
bspc config focused_border_color  "#008DCD"
bspc config presel_feedback_color "#51AFEF"
bspc config urgent_border_color   "#FF6C6B"

###== BSPWM Rules
bspc rule -a Alacritty            desktop='^1' focus=on  follow=on
bspc rule -a kitty                desktop='^1' focus=on  follow=on
bspc rule -a firefox              desktop='^2' focus=on  follow=on
bspc rule -a Google-chrome        desktop='^2' focus=on  follow=on
bspc rule -a Code                 desktop='^3' focus=on  follow=on
bspc rule -a '*:nvim'             desktop='^3' focus=on  follow=on
bspc rule -a '*:ranger'           desktop='^4' focus=on  follow=off
bspc rule -a Thunar               desktop='^4' focus=on  follow=off
bspc rule -a Todoist              desktop='^5' focus=on  follow=off
bspc rule -a Joplin               desktop='^5' focus=on  follow=on
bspc rule -a Simplenote           desktop='^5' focus=on  follow=on
bspc rule -a discord              desktop='^6' focus=off follow=off
bspc rule -a telegram-desktop     desktop='^6' focus=off follow=on
bspc rule -a KeePassXC            desktop='^7' focus=on  follow=off
bspc rule -a Spotify              desktop='^9' focus=on  follow=on
