disk: properly calculate free/total size

On most Unix systems `f_blocks`, `f_bfree`, and `f_bavail` are
reported in units of `f_frsize`.
This commit is contained in:
Jan Beich 2019-09-30 21:40:36 +00:00
parent 4e567d0483
commit 71b7b4e0f4
1 changed files with 3 additions and 3 deletions

View File

@ -44,9 +44,9 @@ auto waybar::modules::Disk::update() -> void {
return;
}
auto free = pow_format(stats.f_bavail * stats.f_bsize, "B", true);
auto used = pow_format((stats.f_blocks - stats.f_bavail) * stats.f_bsize, "B", true);
auto total = pow_format(stats.f_blocks * stats.f_bsize, "B", true);
auto free = pow_format(stats.f_bavail * stats.f_frsize, "B", true);
auto used = pow_format((stats.f_blocks - stats.f_bavail) * stats.f_frsize, "B", true);
auto total = pow_format(stats.f_blocks * stats.f_frsize, "B", true);
label_.set_markup(fmt::format(format_
, stats.f_bavail * 100 / stats.f_blocks