Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

network: bandwidth speed is wrong, shows as sum over all interfaces

Open maximbaz opened this issue 4 years ago • 6 comments

Currently placeholders like {bandwidthDownBits} show the sum across all interfaces, this is a problem if you use a VPN and so all your traffic goes through tunnel interface and then a wireless interface, the numbers shown by waybar are doubled comparing to real internet speed.

I would like to ask that all these placeholders show information about the currently shown interface name.

I tried to enforce the interface name via config "interface": "wlan0" but this doesn't affect these placeholders.

maximbaz avatar Mar 02 '20 13:03 maximbaz

Relevant code is in src/modules/network.cpp It currently uses /proc/net/netstat which gives only global bandwidth speed. It should use /proc/net/dev for having info per interface.

I'll try to look into it if I can (I'm not familiar with C++).

captainju avatar Feb 08 '21 10:02 captainju

yeah, It's even adding the speed of localhost ( playing local videos on browser using jellyfin )

Iss-in avatar Feb 28 '21 13:02 Iss-in

Not sure if it's related but for me the reported speed is too low (~6% with VPN, ~3% without). I'm using Waybar v0.9.7-35-g94a882b on Linux 5.12.3-arch1-1.

b10n avatar May 24 '21 12:05 b10n

I spent some time trying to make the changes to read from /proc/net/dev, but I'm not super comfortable with c++ and struggled to incorporate these changes into the project as it is.

In case it's helpful for the next person that tries to tackle this, here's a standalone program that prints the total bandwidth used for the specified interface https://gist.github.com/ciarand/568e6e8d99aa2f1ba0d489ecba9b0d68

Feel free to steal/copy this code if it's helpful (or ignore it if it's not)

ciarand avatar Aug 24 '21 06:08 ciarand

Sent out #1230 that attempts to fix this

ciarand avatar Aug 25 '21 22:08 ciarand

Looks fixed to me, thanks @ciarand !

captainju avatar Jun 24 '22 08:06 captainju