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)
```
This commit is contained in:
Vincent Bernat 2021-08-23 10:16:03 +02:00
parent 32501093c1
commit 41dba59ce2

View file

@ -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%% *}}