#!/usr/bin/env bash set -euf -o pipefail I=1 M=$(bspc query -M | wc -l) if [[ "$M" == 1 ]]; then bspc monitor -d 1 2 3 4 5 6 7 8 9 10 elif [[ "$M" == 2 ]]; then bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2 3 4 5 bspc monitor "$(bspc query -M | awk NR==2)" -d 6 7 8 9 10 elif [[ "$M" == 3 ]]; then bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2 3 4 bspc monitor "$(bspc query -M | awk NR==2)" -d 5 6 7 bspc monitor "$(bspc query -M | awk NR==3)" -d 8 9 10 elif [[ "$M" == 4 ]]; then bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2 3 bspc monitor "$(bspc query -M | awk NR==2)" -d 4 5 6 bspc monitor "$(bspc query -M | awk NR==3)" -d 7 8 bspc monitor "$(bspc query -M | awk NR==4)" -d 9 10 elif [[ "$M" == 5 ]]; then bspc monitor "$(bspc query -M | awk NR==1)" -d 1 2 bspc monitor "$(bspc query -M | awk NR==2)" -d 3 4 bspc monitor "$(bspc query -M | awk NR==3)" -d 5 6 bspc monitor "$(bspc query -M | awk NR==4)" -d 7 8 bspc monitor "$(bspc query -M | awk NR==5)" -d 9 10 else for monitor in $(bspc query -M); do bspc monitor "$monitor" \ -n "$I" \ -d $I/{a,b,c} (( I++ )) done fi