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 &

View file

@ -69,20 +69,15 @@ label-urgent-padding = 1
# This needs 3.6+
[module/disk]
type = internal/fs
mount-0 = /
mount-1 = /home
mount-2 = /var
mount-3 = /tmp
mount-4 = /var/lib/systems
mount-5 = /boot
warn-percentage = 94
warn-percentage = 80
fixed-values = true
interval = 10
format-unmounted =
format-mounted =
format-warn = <label-warn>
format-warn-foreground = ${colors.warning}
label-warn =  %mountpoint%: %percentage_used%%
label-warn = 🖴 %mountpoint%: %percentage_used%%
include-file = $XDG_RUNTIME_DIR/i3/polybar-filesystems.conf
[module/brightness]
type = internal/backlight