feat: add compact versions of bandwidthBytes to network module

Adds the following:
- bandwidthDownByesCompact
- bandwidthUpByesCompact

Differences from normal version:
- drop the "/s" suffix
- drop the deciaml part if less than 1MB/s
This commit is contained in:
Yui
2026-05-01 22:31:03 +03:00
parent cca8dc38b6
commit c81a039a55
2 changed files with 13 additions and 3 deletions
+8
View File
@@ -368,6 +368,10 @@ auto waybar::modules::Network::update() -> void {
pow_format((bandwidth_up + bandwidth_down) / elapsed_seconds, "o/s")),
fmt::arg("bandwidthDownBytes", pow_format(bandwidth_down / elapsed_seconds, "B/s")),
fmt::arg("bandwidthUpBytes", pow_format(bandwidth_up / elapsed_seconds, "B/s")),
fmt::arg("bandwidthDownBytesCompact",
pow_format(bandwidth_down / elapsed_seconds, "B", false, 2)),
fmt::arg("bandwidthUpBytesCompact",
pow_format(bandwidth_up / elapsed_seconds, "B", false, 2)),
fmt::arg("bandwidthTotalBytes",
pow_format((bandwidth_up + bandwidth_down) / elapsed_seconds, "B/s")));
if (text.compare(label_.get_label()) != 0) {
@@ -401,6 +405,10 @@ auto waybar::modules::Network::update() -> void {
pow_format((bandwidth_up + bandwidth_down) / elapsed_seconds, "o/s")),
fmt::arg("bandwidthDownBytes", pow_format(bandwidth_down / elapsed_seconds, "B/s")),
fmt::arg("bandwidthUpBytes", pow_format(bandwidth_up / elapsed_seconds, "B/s")),
fmt::arg("bandwidthDownBytesCompact",
pow_format(bandwidth_down / elapsed_seconds, "B", false, 2)),
fmt::arg("bandwidthUpBytesCompact",
pow_format(bandwidth_up / elapsed_seconds, "B", false, 2)),
fmt::arg("bandwidthTotalBytes",
pow_format((bandwidth_up + bandwidth_down) / elapsed_seconds, "B/s")));
if (label_.get_tooltip_text() != tooltip_text) {