From 41dba59ce26af9443d4c20090e64c2de745e26b5 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 23 Aug 2021 10:16:03 +0200 Subject: [PATCH] polybar: switch back to xrandr to find monitors For some reason, I get this with polybar: ``` DisplayPort-3-1: 1920x1440+0+0 (XRandR monitor) DisplayPort-3-2: 1520x1440+1920+0 (XRandR monitor) DisplayPort-3: 3440x1440+0+0 (primary) ``` --- bin/polybar | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/polybar b/bin/polybar index d0d3014..54826f0 100755 --- a/bin/polybar +++ b/bin/polybar @@ -3,8 +3,8 @@ export DPI=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p') export HEIGHT=$((18 * DPI / 96)) -MONITORS=$(polybar --list-monitors | sed -nE 's/([^ ]+): .*/\1/p' | tr '\n' ' ') -PRIMARY=$(polybar --list-monitors | grep -F '(primary)' | sed -nE 's/([^ ]+): .*/\1/p') +MONITORS=$(xrandr --current --listactivemonitors | sed -nE 's/ *([0-9]+): [+*]*([^ ]*).*/\2/p' | tr '\n' ' ') +PRIMARY=$(xrandr --current --listactivemonitors | sed -nE 's/ *([0-9]+): [+]?[*]([^ ]*).*/\2/p') NMONITORS=$(echo $MONITORS | wc -w) PRIMARY=${PRIMARY:-${MONITORS%% *}}