elkowar / eww

ElKowars wacky widgets

Home Page:https://elkowar.github.io/eww

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] EWW_NET is all 0

danjenson opened this issue · comments

Checklist before submitting an issue

  • I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • I have specifically verified that this bug is not a common user error
  • I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

EWW_NET magic variable return 0 for all interfaces, despite btop showing traffic and ping explicitly run to create traffic on target interface.

image

Reproducing the issue

Just updated to the most recent version of eww.

Expected behaviour

EWW_NET should be populated.

Additional context

No response

Can confirm, updated to version 0.5.0 and got this bug, same for the latest git commit

This seems like an issue with the sysinfo crate. I tried logging the old_rx_bytes and rx_bytes the crate keeps track of to find the number of bytes received since the last refresh and they were equal. Can anyone confirm whether this is true so we can open an issue in the upstream repo?

In the meantime, we can keep track of the total bytes received (which is correct), and calculate the difference in eww. The total bytes could also be exported in the EWW_NET magic var this way.

Another workaround would be to get the total bytes before and after running the networks.refresh().

I had a look at the source code of the sysinfo crate.
It seems both the refresh and refresh_list functions on the Networks struct update the data.

eww (via

pub fn net() -> String {
) calls both right after each other.

The fix would be deleting one of those function calls.

refresh_list also updates the list of interfaces. Those rarely change on a typical system, but keeping refresh_list would be closer to the behaviour pre 0.5.0.

refresh only updates the data for the currently known interfaces, which might perform slightly better, but probably only negligible.