Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

Help needed [network module]

Open EliaHKM opened this issue 3 years ago • 10 comments

Hi 🙋🏻, Could you correct me

`"network": { // "interface": "wlp2*", // (Optional) To force the use of this interface "format-wifi": "{essid} ({signalStrength}%) 🌊", "format-ethernet": "{ifname}: {ipaddr}/{cidr} 🔗 | {bandwidthUpBits} ⬆️ {bandwidthDownBits} ⬇️ ", "format-linked": "{ifname} (No IP) ⛔", "format-disconnected": "Disconnected ✈️", "format-alt": "{ifname}: {ipaddr}/{cidr}"

},` how can I make the bandwidth working it gives 0b/s thanks in advance

EliaHKM avatar Apr 02 '22 23:04 EliaHKM

Same issue. And if I put in {bandwidthUpBytes}, it the module disappears entirely.

evanmohr avatar Apr 11 '22 01:04 evanmohr

Whenever I use format-ethernet together with bandwitdh*Bytes I just get an error, that the argument can't be found

Ah yes. Bytes just doesn't exist, so the wiki is wrong. Unrelated problem apparently.

UltraBlackLinux avatar Apr 24 '22 16:04 UltraBlackLinux

bandwidthupbytes does exist. It has a bug.

% grep bandwidthUpB
man/waybar-network.5.scd
*{bandwidthUpBits}*: Instant up speed in bits/seconds.

src/modules/network.cpp
      fmt::arg("bandwidthUpBits", pow_format(bandwidth_up * 8ull / interval_.count(), "b/s")),
      fmt::arg("bandwidthUpBytes", pow_format(bandwidth_up / interval_.count(), "B/s")));
          fmt::arg("bandwidthUpBits", pow_format(bandwidth_up * 8ull / interval_.count(), "b/s")),
          fmt::arg("bandwidthUpBytes", pow_format(bandwidth_up / interval_.count(), "B/s")));

hboetes avatar May 21 '22 23:05 hboetes

The speed stays 0 initially but starts updating speed after a minute. The interval setting is 60 by default.

"network": {
    "interval": 5, // in seconds
    "format-wifi": "{essid} ({signalStrength}%) ocean",
    "format-ethernet": "{ifname}: {ipaddr}/{cidr} link | {bandwidthUpBits} arrow_up {bandwidthDownBits} arrow_down ",
    "format-linked": "{ifname} (No IP) no_entry",
    "format-disconnected": "Disconnected airplane",
    "format-alt": "{ifname}: {ipaddr}/{cidr}"
}

yoogottamk avatar Jun 10 '22 17:06 yoogottamk

So the interval gets ignored regarding the {bandwidthUpBits} or {bandwidthUpBytes} variable?

kooskaspers avatar Jun 23 '22 06:06 kooskaspers

No The default interval is 1 minute. Those values get updated every interval seconds.

By default, it would mean that {bandwidthUpBits} or {bandwidthUpBytes} get updated every minute. Initially the values must be 0, that's why the speed stays 0 for a long time before changing to something else.

The module works (for me at least). Just reduce the interval.

yoogottamk avatar Jun 23 '22 06:06 yoogottamk

Got it. I assigned "1" as an interval, it shoud've been just 1, without quotes (int).

kooskaspers avatar Jun 23 '22 14:06 kooskaspers

By the way, I'm trying to set the module width to a fixed position by specifying: "format-wifi": " {bandwidthUpBytes:6} {bandwidthDownBytes:6}" This is working fine for like the cpu module, but the network module isn't respecting these max 6 length positions. It's still adjusting it's width. Any idea how to cope with this?

kooskaspers avatar Jun 23 '22 15:06 kooskaspers

@kooskaspers The request for a fixed width for network module is mentioned in Limit length of modules · Issue #486 · Alexays/Waybar and the pr: Add a custom formatter for "pow" numbers. by layus · Pull Request #472 · Alexays/Waybar

In short: "format-wifi": " {bandwidthDownBytes:>} {bandwidthUpBytes:>}", and I get a constant fixed by reserving space for it.

kohane27 avatar Jul 20 '22 01:07 kohane27

@kooskaspers The request for a fixed width for network module is mentioned in Limit length of modules · Issue #486 · Alexays/Waybar and the pr: Add a custom formatter for "pow" numbers. by layus · Pull Request #472 · Alexays/Waybar

In short: "format-wifi": " {bandwidthDownBytes:>} {bandwidthUpBytes:>}", and I get a constant fixed by reserving space for it.

Tested, and working great! Thanks.

kooskaspers avatar Jul 21 '22 06:07 kooskaspers