2018-01-20 13:56:55 -06:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# start.sh
|
|
|
|
# Copyright (C) 2018 salt <salt@iridium>
|
|
|
|
#
|
|
|
|
# Distributed under terms of the MIT license.
|
|
|
|
#
|
2018-05-06 01:55:10 -05:00
|
|
|
export PB_WM_RESTACK=bspwm
|
2018-01-20 13:56:55 -06:00
|
|
|
|
|
|
|
# Iterate through monitors and spawn bars on each
|
|
|
|
# Starting with the primary monitor...
|
2018-07-31 19:33:48 -05:00
|
|
|
export PB_MONITOR=$(xrandr -q | awk '/primary/{print $1}')
|
2018-01-20 13:56:55 -06:00
|
|
|
if [[ $PB_MONITOR == "" ]]; then
|
2018-05-06 02:15:38 -05:00
|
|
|
unset PB_MONITOR
|
2018-01-20 13:56:55 -06:00
|
|
|
fi
|
2018-07-31 20:05:24 -05:00
|
|
|
printf "[INFO] Starting Polybar primary on monitor $PB_MONITOR"
|
2018-05-18 00:20:20 -05:00
|
|
|
polybar -r primary&
|
2018-06-20 22:04:13 -05:00
|
|
|
polybar -r primary-2&
|
2018-01-20 13:56:55 -06:00
|
|
|
# ...and then moving on to secondaries, if we have them
|
2018-01-31 19:50:31 -06:00
|
|
|
# Alright, now this looks *really* bad, spawning so many subprocesses, but
|
|
|
|
# there's no way in hell you can get me to attempt to solve this with regex.
|
|
|
|
# To hell with regex. It starts more problems than it solves
|
2018-01-20 13:56:55 -06:00
|
|
|
export secondary_monitors=$(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}')
|
2018-01-21 16:44:53 -06:00
|
|
|
if [[ $secondary_monitors == "" ]]; then
|
2018-01-20 13:56:55 -06:00
|
|
|
exit 0
|
|
|
|
fi
|
2018-01-21 16:44:53 -06:00
|
|
|
for monitor in $secondary_monitors; do
|
2018-07-31 20:05:24 -05:00
|
|
|
printf "[INFO] Starting Polybar secondary on monitor $monitor"
|
2018-02-08 00:54:04 -06:00
|
|
|
PB_MONITOR=$monitor polybar -r secondary
|
2018-01-20 13:56:55 -06:00
|
|
|
done
|
|
|
|
|
|
|
|
disown
|
|
|
|
exit
|