Waybar
Waybar copied to clipboard
network: bandwidth speed is wrong, shows as sum over all interfaces
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.
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++).
yeah, It's even adding the speed of localhost ( playing local videos on browser using jellyfin )
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.
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)
Sent out #1230 that attempts to fix this
Looks fixed to me, thanks @ciarand !