home/.config/bspwm/monitorset.sh
Salt 9e1b4556d3 bspwm: Move monitor setup to its own file
It's complex enough to warrant it, I'd say
2018-08-01 19:50:05 -05:00

21 lines
755 B
Bash
Executable File

#! /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