mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
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:
parent
4e567d0483
commit
71b7b4e0f4
@ -44,9 +44,9 @@ auto waybar::modules::Disk::update() -> void {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto free = pow_format(stats.f_bavail * 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_bsize, "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_bsize, "B", true);
|
auto total = pow_format(stats.f_blocks * stats.f_frsize, "B", true);
|
||||||
|
|
||||||
label_.set_markup(fmt::format(format_
|
label_.set_markup(fmt::format(format_
|
||||||
, stats.f_bavail * 100 / stats.f_blocks
|
, stats.f_bavail * 100 / stats.f_blocks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user