mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 18:58:33 +02:00
24 lines
846 B
Bash
Executable file
24 lines
846 B
Bash
Executable file
#!/bin/sh
|
|
|
|
export DPI=$(xrdb -query | sed -nE 's/^Xft\.dpi:\s*//p')
|
|
export HEIGHT=$((18 * DPI / 96))
|
|
|
|
MONITORS=$(xrandr --current | awk '($0 ~ / connected / && $0 ~ / [0-9]+x[0-9]+\+/) {print $1}' | tr '\n' ' ')
|
|
PRIMARY=$(xrandr --current | awk '($0 ~ / connected primary / && $0 ~ / [0-9]+x[0-9]+\+/) {print $1; exit}')
|
|
PRIMARY=${PRIMARY:-${MONITORS%% *}}
|
|
|
|
awk 'BEGIN { i=0 } ($4 == "/" && $3 !~ /^0:/) {print "mount-"i" = "$5; i++}' /proc/self/mountinfo \
|
|
> $XDG_RUNTIME_DIR/i3/polybar-filesystems.conf
|
|
|
|
case $(echo $MONITORS | wc -w) 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
|