From b31a64ad0088aa8773b64f9eb6393f9f950f14be Mon Sep 17 00:00:00 2001 From: Lucas Lazare Date: Sat, 18 May 2019 09:13:00 -0400 Subject: [PATCH] Displaying in ko/s and kb/s instead of interval dependant unit --- src/modules/network.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/network.cpp b/src/modules/network.cpp index baa546da..8f767f0b 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -302,10 +302,10 @@ auto waybar::modules::Network::update() -> void { fmt::arg("cidr", cidr_), fmt::arg("frequency", frequency_), fmt::arg("icon", getIcon(signal_strength_, connectiontype)), - fmt::arg("bandwidthDownBits", pow_format(bandwidth_down * 8ull, "b")), - fmt::arg("bandwidthUpBits", pow_format(bandwidth_up * 8ull, "b")), - fmt::arg("bandwidthDownOctets", pow_format(bandwidth_down, "o")), - fmt::arg("bandwidthUpOctets", pow_format(bandwidth_up, "o"))); + fmt::arg("bandwidthDownBits", pow_format(bandwidth_down * 8ull / interval_.count(), "b/s")), + fmt::arg("bandwidthUpBits", pow_format(bandwidth_up * 8ull / interval_.count(), "b/s")), + fmt::arg("bandwidthDownOctets", pow_format(bandwidth_down / interval_.count(), "o/s")), + fmt::arg("bandwidthUpOctets", pow_format(bandwidth_up / interval_.count(), "o/s"))); label_.set_markup(text); if (tooltipEnabled()) { if (!tooltip_format.empty()) { @@ -319,10 +319,10 @@ auto waybar::modules::Network::update() -> void { fmt::arg("cidr", cidr_), fmt::arg("frequency", frequency_), fmt::arg("icon", getIcon(signal_strength_, connectiontype)), - fmt::arg("bandwidthDownBits", pow_format(bandwidth_down * 8ull, "b")), - fmt::arg("bandwidthUpBits", pow_format(bandwidth_up * 8ull, "b")), - fmt::arg("bandwidthDownOctets", pow_format(bandwidth_down, "o")), - fmt::arg("bandwidthUpOctets", pow_format(bandwidth_up, "o"))); + fmt::arg("bandwidthDownBits", pow_format(bandwidth_down * 8ull / interval_.count(), "b/s")), + fmt::arg("bandwidthUpBits", pow_format(bandwidth_up * 8ull / interval_.count(), "b/s")), + fmt::arg("bandwidthDownOctets", pow_format(bandwidth_down / interval_.count(), "o/s")), + fmt::arg("bandwidthUpOctets", pow_format(bandwidth_up / interval_.count(), "o/s"))); label_.set_tooltip_text(tooltip_text); } else { label_.set_tooltip_text(text);