bspwm: Add funky monitor allocation back

This commit is contained in:
Salt 2020-05-31 18:01:57 -05:00
parent 13da355781
commit 145ead604f

44
.config/bspwm/bspwmrc Normal file → Executable file
View File

@ -1,9 +1,49 @@
#!/usr/bin/env bash
#!/bin/bash
#
# bspwmrc
# bspwm configuration file
#
## Monitor allocation
# Honestly pretty complex
setmon() {
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
@ -12,7 +52,7 @@ bspc config remove_unplugged_monitors true
# Pointer behavior
bspc config click_to_focus any
bspc config pointer_follows_focus false
bspc config pointer_follows_focus true
bspc config pointer_follows_monitor true
bspc config pointer_modifier mod1
bspc config pointer_action1 move #LMB