mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-29 21:04:21 +02:00
For some reason, this makes X probe again the monitors. Switch to `xrandr --current` seems to make this problem goes away. Maybe, this is also `polybar --list-monitors` keeping a grab while polybar is starting.
21 lines
622 B
Bash
Executable file
21 lines
622 B
Bash
Executable file
#!/bin/sh
|
|
|
|
export DPI=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p')
|
|
export HEIGHT=$((20 * DPI / 96))
|
|
|
|
MONITORS=$(xrandr --current | awk '($0 ~ / connected / && $0 ~ / [0-9]+x[0-9]+\+/) {print $1}')
|
|
PRIMARY=$(xrandr --current | awk '($0 ~ / primary /) {print $1; exit}')
|
|
NUMS=$(echo $MONITORS | wc -w)
|
|
case $NUMS in
|
|
1)
|
|
MONITOR=$PRIMARY polybar --reload alone &
|
|
;;
|
|
*)
|
|
MONITOR=$PRIMARY polybar --reload primary &
|
|
for MONITOR in ${MONITORS}; do
|
|
[ $MONITOR != $PRIMARY ] || continue
|
|
MONITOR=$MONITOR polybar --reload secondary &
|
|
done
|
|
;;
|
|
esac
|
|
wait
|