#!/bin/sh
# my bspwmrc

# desktops
bspc monitor -d I II III IV V VI VII VIII IX X

# borders
bspc config focused_border_color "#383838"
bspc config normal_border_color "#282828"
bspc config border_width 2

# layout
bspc config window_gap 10
bspc config split_ratio 0.5
bspc config smart_gap true

# focus behavior
bspc config focus_follows_pointer true
bspc config click_to_focus false
bspc config pointer_follows_monitor true

# monitor / window behavior
bspc config remove_disabled_monitors true
bspc config auto_cancel true
bspc config auto_alternate true

# padding
bspc config bottom_padding 0


### {{{ find and stop processes

pidb() {
	pgrep -x "$1" >/dev/null 2>&1
}

run() {
	proc="$1"
	cmd="$2"

	if ! pidb "$proc"; then
		sh -c "$cmd" &
	fi
}

### }}}


### {{{ rerun/start processes

# piss
run "piss" "piss"

# picom
run "picom" "picom --backend glx"

# dunst
run "dunst" "dunst"

# bspbar
run "bspbar" "bspbar"

# polkit gnome
run "polkit-gnome-authentication-agent-1" \
	"/usr/libexec/polkit-gnome-authentication-agent-1"

# xsettingsd
run "xsettingsd" "xsettingsd"

# pulseaudio
run "pulseaudio" "pulseaudio --start"

# pipewire
run "pipewire" "pipewire"

# xtkhd
run "xtkhd" "xtkhd"

xrandr --output eDP-1 --off
hsetroot -center "$HOME/Downloads/wall4.png"

### }}}
