2021-07-04 18:25:28 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
export DPI=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p')
|
|
|
|
export HEIGHT=$((20 * DPI / 96))
|
|
|
|
|
2021-08-01 15:25:53 +02:00
|
|
|
MONITORS=$(xrandr --current --listactivemonitors | sed -nE 's/ *([0-9]+): [+*]*([^ ]*).*/\2/p')
|
|
|
|
PRIMARY=$(xrandr --current --listactivemonitors | sed -nE 's/ *([0-9]+): [+]?[*]([^ ]*).*/\2/p')
|
2021-07-15 19:12:36 +02:00
|
|
|
PRIMARY=${PRIMARY:-${MONITORS%% *}}
|
2021-07-15 20:52:32 +02:00
|
|
|
|
|
|
|
case $(echo $MONITORS | wc -w) in
|
2021-07-08 08:10:37 +02:00
|
|
|
1)
|
2021-07-17 11:09:04 +02:00
|
|
|
MONITOR=$PRIMARY polybar --reload alone &
|
2021-07-08 08:10:37 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
MONITOR=$PRIMARY polybar --reload primary &
|
2021-07-15 14:32:00 +02:00
|
|
|
for MONITOR in ${MONITORS}; do
|
|
|
|
[ $MONITOR != $PRIMARY ] || continue
|
|
|
|
MONITOR=$MONITOR polybar --reload secondary &
|
2021-07-08 08:10:37 +02:00
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|