From: Mirko Augsburger Date: Thu, 24 Jun 2010 23:19:09 +0000 (+0200) Subject: disk_info: implement %avail X-Git-Tag: 2.2~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=28ba2ae8920ed5a020d51d51ee75dd8899aa0df1;p=i3%2Fi3status disk_info: implement %avail --- diff --git a/man/i3status.man b/man/i3status.man index b7f362e..42d2e33 100644 --- a/man/i3status.man +++ b/man/i3status.man @@ -125,11 +125,11 @@ best available public IPv6 address on your computer). === Disk -Gets used, free and total amount of bytes on the given mounted filesystem. +Gets used, free, available and total amount of bytes on the given mounted filesystem. *Example order*: +disk /mnt/usbstick+ -*Example format*: +%free / %total+ +*Example format*: +%free (%avail)/ %total+ === Run-watch diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 3bd2bf8..b9ec84b 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -64,5 +64,10 @@ void print_disk_info(const char *path, const char *format) { print_bytes_human((uint64_t)buf.f_bsize * (uint64_t)buf.f_blocks); walk += strlen("total"); } + + if (BEGINS_WITH(walk+1, "avail")) { + print_bytes_human((uint64_t)buf.f_bsize * (uint64_t)buf.f_bavail); + walk += strlen("avail"); + } } }