polybar: generate mountpoints automatically

This commit is contained in:
Vincent Bernat 2021-08-02 22:59:26 +02:00
parent 0e76f2c3ad
commit cb9e692c8d
2 changed files with 6 additions and 8 deletions

View file

@ -7,6 +7,9 @@ MONITORS=$(xrandr --current --listactivemonitors | sed -nE 's/ *([0-9]+): [+*]*(
PRIMARY=$(xrandr --current --listactivemonitors | sed -nE 's/ *([0-9]+): [+]?[*]([^ ]*).*/\2/p')
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 &