aboutsummaryrefslogtreecommitdiffstats
path: root/i3wm/.config/polybar/launch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'i3wm/.config/polybar/launch.sh')
-rwxr-xr-xi3wm/.config/polybar/launch.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/i3wm/.config/polybar/launch.sh b/i3wm/.config/polybar/launch.sh
index a0f26cd..e099ebb 100755
--- a/i3wm/.config/polybar/launch.sh
+++ b/i3wm/.config/polybar/launch.sh
@@ -6,8 +6,15 @@ killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
+
# Launch bar1 and bar2
-MONITOR=$(polybar -m|tail -1|sed -e 's/:.*$//g') polybar topbar &
-MONITOR=$(polybar -m|tail -1|sed -e 's/:.*$//g') polybar topbar-second &
+MONITOR=$(polybar -m|tail -n1|sed -e 's/:.*$//g') polybar topbar &
+
+MONITORS=$(polybar -m|sed -e 's/:.*$//g')
+while read -r monitor; do
+ MONITOR=$monitor polybar topbar-second &
+done <<< $MONITORS
+
+PRIMARY_MONITOR=$(xrandr -q|awk '/ connected primary /'|cut -d ' ' -f1)
echo "Bars launched..."