From 80bfb36919a49dcbac561aecd188a3153c0add54 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Mon, 11 Apr 2022 09:57:47 -0400 Subject: [PATCH] polybar: Don't hardcode monitor to display on Now polybar will show on all monitors by default, and we don't have to update the script every time those monitors change, useful when changing between computers that use HDMI and computers that use display port, for example. --- polybar/.config/polybar/config | 2 +- polybar/.config/polybar/launch.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index 9da60225..6c97cc95 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -17,7 +17,7 @@ modules-left = bspwm modules-center = window modules-right = cpu ram volume wifi date time battery -monitor = eDP +monitor = ${env:MONITOR:} wm-restack = bspwm include-file = $HOME/.cache/polybar/config diff --git a/polybar/.config/polybar/launch.sh b/polybar/.config/polybar/launch.sh index 0ea3db20..c6598fc8 100755 --- a/polybar/.config/polybar/launch.sh +++ b/polybar/.config/polybar/launch.sh @@ -52,5 +52,7 @@ echo $BSPWM_TOP_PADDING > $HOME/.cache/polybar/bspwm_top_padding # Wait until there are no more polybar instances running while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done -# Start polybar -polybar main & +# Start polybar programmatically on all monitors by default +for m in $(polybar --list-monitors | cut -d":" -f1); do + MONITOR=$m polybar main & +done