polybar: fix monitor detection on clone

Polybar knows how to do that, let's just use polybar --list-monitors.
This commit is contained in:
Vincent Bernat 2021-08-14 20:51:29 +02:00
parent 08e33d4d39
commit 62a831ac40

View file

@ -3,8 +3,8 @@
export DPI=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p')
export HEIGHT=$((18 * DPI / 96))
MONITORS=$(xrandr --current --listactivemonitors | sed -nE 's/ *([0-9]+): [+*]*([^ ]*).*/\2/p')
PRIMARY=$(xrandr --current --listactivemonitors | sed -nE 's/ *([0-9]+): [+]?[*]([^ ]*).*/\2/p')
MONITORS=$(polybar --list-monitors | sed -nE 's/([^ ]+): .*/\1/p')
PRIMARY=$(polybar --list-monitors | grep -F '(primary)' | sed -nE 's/([^ ]+): .*/\1/p')
PRIMARY=${PRIMARY:-${MONITORS%% *}}
awk 'BEGIN { i=0 } ($4 == "/" && $3 !~ /^0:/) {print "mount-"i" = "$5; i++}' /proc/self/mountinfo \