dotfiles/.config/load_workspace.sh

24 lines
625 B
Bash
Raw Normal View History

#!/bin/bash
set -x
$HOME/.fehbg &
DISPLAYS=$(xrandr -q | grep -w 'connected' | grep -v 'primary' | cut -d ' ' -f 1)
PRIMARY_DISPLAY=$(xrandr -q | grep -w 'connected primary' | cut -d ' ' -f 1)
echo "Displays '${DISPLAYS}' have been detected. '${PRIMARY_DISPLAY}' is primary."
EXT_DISPLAY=${DISPLAYS%% *}
killall -q polybar
if [ "${EXT_DISPLAY}" != "" ]; then
bspc monitor ${PRIMARY_DISPLAY} -d 1 2 3 4 5
bspc monitor ${EXT_DISPLAY} -d 6 7 8 9 0
MONITOR=${EXT_DISPLAY} polybar main & disown
else
bspc monitor ${PRIMARY_DISPLAY} -d 1 2 3 4 5 6 7 8 9 0
fi
MONITOR=${PRIMARY_DISPLAY} polybar main & disown