From febd8e24ca545d3ebaf7f5faa1b2a190fced35fe Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 7 Dec 2018 18:43:32 +0100 Subject: [PATCH] Ignore cifs network mounts (FS starting with //) Signed-off-by: Knut Ahlers --- .config/i3blocks/disk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.config/i3blocks/disk b/.config/i3blocks/disk index 41d1d66..0208759 100755 --- a/.config/i3blocks/disk +++ b/.config/i3blocks/disk @@ -5,19 +5,20 @@ import sys CRIT = 90.0 MOUNT_BLACKLIST = ['/dev', '/efi', '/proc', '/run', '/sys', '/tmp'] +FS_BLACKLIST = ['//', 'cgroup', 'tmpfs'] def main(): output = subprocess.check_output([ - 'sh', '-c', 'df -a -B 1 | awk \'{ printf "%s\\t%d\\t%d\\n", $6, $2, $4 }\'' + 'sh', '-c', 'df -a -B 1 | awk \'{ printf "%s\\t%d\\t%d\\t%s\\n", $6, $2, $4, $1 }\'' ]).decode('utf-8') fs = {} for line in output.split('\n'): if len(line) == 0 or line[0] != '/': continue - (mountpoint, total, available) = line.split('\t') - fs[mountpoint] = (total, available) + (mountpoint, total, available, filesystem) = line.split('\t') + fs[mountpoint] = (total, available, filesystem) color = '#50fa7b' @@ -28,6 +29,10 @@ def main(): if mount.startswith(b): skip = True + for b in FS_BLACKLIST: + if data[2].startswith(b): + skip = True + if skip: continue