21 lines
755 B
Bash
21 lines
755 B
Bash
|
#! /bin/bash
|
||
|
#
|
||
|
# monitorset.sh
|
||
|
# Copyright (C) 2018 salt <salt@dsk-cstm-0>
|
||
|
#
|
||
|
# Distributed under terms of the MIT license.
|
||
|
#
|
||
|
|
||
|
printf "[INFO] Setting up monitors\n"
|
||
|
# 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[@]})
|
||
|
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
|
||
|
|