home/.config/bspwm/bspwmrc

99 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
#
# bspwmrc
# bspwm configuration file
#
## Monitor allocation
# Honestly pretty complex
setmon() {
# First of all, we're gonna fix our monitor configs here
case $(hostname) in
dsk-cstm-0)
xrandr --output DisplayPort-1 --mode 2560x1440 --rate 144 --primary
xrandr --output HDMI-A-0 --mode 1920x1080 --rate 60 --pos 2560x360
;;
esac
desktops_total=8
desktops_primary=6
desktops_secondary=$(( desktops_total - desktops_primary ))
monitor_primary="$(xrandr -q | awk '/primary/{print $1}')"
monitors_secondary=($(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}'))
# Ensure we have enough for every monitor
if (( desktops_secondary < ${#monitors_secondary[@]} )); then
echo "Adding more desktops to match connected monitors"
desktops_secondary=${#monitors_secondary[@]}
desktops_total=$(( desktops_secondary + desktops_primary ))
fi
if (( ${#monitors_secondary[@]} == 0 )); then
echo "Only one monitor allocated"
layout=$(seq --separator=" " 1 $desktops_total)
echo "Setting layout $layout"
bspc monitor $monitor_primary -d $layout
else
echo "${#monitors_secondary[@]} monitors connected"
deskpermon=$(( desktops_secondary / ${#monitors_secondary[@]} ))
layout=$(seq --separator=" " 1 $desktops_primary)
echo "Setting primary layout $layout"
bspc monitor $monitor_primary -d $layout
for m in $(seq 0 $(( ${#monitors_secondary[@]} - 1 ))); do
layout=$(seq --separator=" " \
$(( 1 + m + desktops_primary )) \
${#monitors_secondary[@]} \
"$desktops_total" \
)
echo "Setting layout for ${monitors_secondary[$m]} to $layout"
bspc monitor ${monitors_secondary[$m]} -d $layout
done
fi
}
setmon
## Behavior
# Tiling behavior
bspc config split_ratio 0.50
bspc config remove_disabled_monitors false
bspc config remove_unplugged_monitors true
# Pointer behavior
bspc config click_to_focus any
bspc config pointer_follows_focus true
bspc config pointer_follows_monitor true
bspc config pointer_modifier mod1
bspc config pointer_action1 move #LMB
bspc config pointer_action2 resize_corner #RMB
## Looks
# Padding
bspc config border_width 4
bspc config window_gap 6
bspc config single_monocle false
bspc config borderless_monocle false
bspc config gapless_monocle false
# Colors
bspc config normal_border_color "#31363b" #Unfocused
bspc config active_border_color "#1abc9c" #Focused, but current monitor isn't
bspc config focused_border_color "#1d99f3" #Focused completely
bspc config presel_feedback_color "#eff0f1" #???
## Rules
bspc rule -r '*'
bspc rule -a Firefox desktop=1
bspc rule -a Firefox-esr desktop=1
bspc rule -a Waterfox desktop=1
bspc rule -a Riot desktop=7
bspc rule -a discord desktop=7
bspc rule -a spotify desktop=8
bspc rule -a cantata desktop=8
bspc rule -a 'Minecraft 1.7.10' state=fullscreen
# For fullscreen Wine
bspc rule -a explorer.exe state=fullscreen
# Plasma rules
bspc rule -a plasmashell state=floating sticky=on border=off
bspc rule -a krunner state=floating layer=above sticky=on border=off
# Widgets
bspc rule -a Conky state=floating layer=below sticky=on
bspc rule -a pavucontrol-qt state=floating layer=above sticky=on