bspwm: Make workspace assignment code to be proud of
This commit is contained in:
parent
fd1836016a
commit
73315922ae
@ -28,28 +28,22 @@ fi
|
||||
unset dtfscript
|
||||
|
||||
## bspwm GENERAL CONFIGURATION
|
||||
printf "[INFO] Configuring bspwm\n"
|
||||
printf "[INFO] Setting up monitors\n"
|
||||
monitors=$(bspc query -M | wc -l)
|
||||
# Get the primary first, to ensure it's the first element
|
||||
monitors=($(xrandr -q | awk '/primary/{print $1}' && xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}'))
|
||||
desktops=8
|
||||
deskpermon=$(expr $desktops / $monitors)
|
||||
i=1
|
||||
printf " [INFO] Putting $desktops desktops across $monitors monitors, $deskpermon each\n"
|
||||
for monitor in $(xrandr -q | awk '/primary/{print $1}' && xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}'); do
|
||||
until [[ "$(expr $i % \( $deskpermon + 1 \))" == "0" ]]; do
|
||||
layout="$layout $i"
|
||||
i=$(expr $i + 1)
|
||||
done
|
||||
printf " [INFO] Giving monitor $monitor layout $layout\n"
|
||||
bspc monitor $monitor -d $layout
|
||||
layout="$i"
|
||||
i=$(expr $i + 1)
|
||||
deskpermon=$(expr $desktops / ${#monitors[@]})
|
||||
printf " [INFO] Putting $desktops desktops across ${#monitors[@]} monitors, $deskpermon each\n"
|
||||
for m in $(seq 0 $(expr ${#monitors[@]} - 1)); do
|
||||
layout=$(seq --separator=" " $(expr 1 + $m) ${#monitors[@]} $(expr $desktops ))
|
||||
printf " [INFO] Giving monitor $m (${monitors[$m]}) layout \"$layout\"\n"
|
||||
bspc monitor ${monitors[$m]} -d $layout
|
||||
done
|
||||
unset layout
|
||||
unset monitors
|
||||
unset desktops
|
||||
unset deskpermon
|
||||
|
||||
printf "[INFO] Configuring bspwm\n"
|
||||
bspc config border_width 4
|
||||
bspc config window_gap 6
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user