New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.9.9 - don't work "network" {bandwidth*} #1392
Comments
I believe it was caused by commit 9d9f959 which states that setting interface to "*" should result in the same as the old auto implementation. This isn't documented in the wiki though and should probably be the default since the old default no longer works. |
I've done testing on that commit and setting the interface to "*" does not have the same behavior as the old auto implementation. There probably wasn't enough testing done on different configurations prior to this commit, and I'm working on a fix. In the meantime, a PR to fix the wiki and reset the default would be helpful. |
How to set up multiple interfaces? |
I don't think it's just the "auto" or wildcard detection; even when I set up the interface to
|
I had another type problem (network related) so I looked at the code. I think that the change was done to try and show initial parameters (bandwidth doesn't show immediately, but after 1st refresh) |
I don't believe this solves the "auto-select" problem either
…On Sat, Feb 5, 2022 at 9:20 AM droc12345 ***@***.***> wrote:
I had another type problem (network related) so I looked at the code.
and between 0.98 and 0.99 only 2 changes were made to network.cpp (1 of
which was a comment)
the other is line 81 want_route_dump was changed from false to true,
changing it back fixed my problem.
I think that the change was done to try and show initial parameters
(bandwidth doesn't show immediately, but after 1st refresh)
But evidently setting want_route_dump to true creates some other issue(s).
—
Reply to this email directly, view it on GitHub
<#1392 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALWO5TFBKUQFQORW3ZQQ7JTUZVE37ANCNFSM5L7EJNIA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
I have tried a few different things (config file) "interface": "eth0", -- shows eth0 and data "interface": "*", -- shows lo and no data With the "lo" being what I would expect as it's the first interface shown (on my system) in /proc/net/dev Edit to add: IMO, interface name should always be in config file Edit to add 2: You can sort of figure out the interface, if you ignore the "lo" line and you don't have more than one network connection. But if I have eth0, tun0 and wifi0 how does it determine which one to use? |
I agree - it appears with regex you can ignore interfaces you don't care about, but there isn't logic to determine prioritization of networks. Maybe we could add some logic to find all interfaces matching the config file, then sort by volume of network traffic? |
Ohhh, thanks to @droc12345, I've just realised what was meant by "interface" in this thread! It's a waybar config setting. So now adding the
|
It would be hard (to satisfy everyone) by trying to choose which interface to use, when there is more than one interface. Trying to determine by usage would be difficult, as that number is in constant flux. |
Great point. Just brainstorming here. What about this - building in scroll functionality for the network module, where when you scroll on the module, it cycles through all the interfaces that match the regex? This would remove the need for interface to be a required parameter, or for us to try and guess a default. |
If there is no interface specified (not sure why we really want that) then is there a way to provide an ability to show all interfaces and allow the user to select one? prog/script pops up when no interface is specified or there is more than 2 interfaces (lo and another) . To me this would be easier than trying to fit scrolling/cycing. Lets look at my case, I have lo, eth0 and when I turn on the vpn I have tun0, and when I turn the vpn off tun0 goes away. |
I believe that the networks would be polled and matched against the "interface" parameter on every refresh. The current default is 60s. So it would be a matter of storing an array of interfaces with associated network information and updating the entire array each refresh period. Then having way bar select one interface from that array to display, and building a functionality to change which is displayed (whether the built in scroll ability, the click functionality, or something new) and persisting that selection across refreshes. |
That might work (mine is 2 sec refresh as I like to see more or less current usage) and as long as the interface parm is still being recognized, then I see no harm. You might want to keep a flag for interface/no-interface(or wildcard) so that easy choices could be made if this extends into more than one or two functions though. |
Mine is set to 2s as well actually.
What do you mean by this? |
If a function calls some other function or the code changes extends into multiple functions, and it has to make choices based on being given an interface name or finding them out, it would be nice to have a flag saying it's been given an interface vs figure out the interfaces, kind of like the want_route_dump flag, just something that's easy to use for making choices. I'll mention the interface (config file) once again, whether using the interface tag or making a choice because they're offered multiple interfaces (scrolling, etc), they HAVE to make a choice. To me it's easiest to do it in the config file. Another possible option (just off the top of my head) is if no interface specified, put all that data into something like a tooltip that shows all interfaces (and data) when hovered, rather than letting them select from scrolling/menu selection |
So this would entail changing the default tooltip format to being a list of possible interfaces and data. I think it would only be feasible to list the interfaces, not the data. That would be a ton of text for a tooltip otherwise. But that is a good idea - could format it like the default CPU tooltip? Could we combine the two ideas? If no interface is specified use * as the default, have the default tooltip be a list of interfaces, and include scroll functionality by default as well? Could update the wiki with a description of all of this. |
That sounds feasible |
Might mention in the docs/wiki that the interface name (config option) is the same as what is returned from |
That's really helpful, I agree. I'm going to start work on this at https://github.com/bd-g/Waybar, you're welcome to contribute/collaborate |
line 108-117 of network.cpp has an if condition to check whether the interface is up (want_route_dump_) This is off the top of my head, so I haven't tried it. |
I'm not sure about compatibility with old behavior but got mine to work without explicit diff --git a/src/modules/network.cpp b/src/modules/network.cpp
index 74b54d9..3b88011 100644
--- a/src/modules/network.cpp
+++ b/src/modules/network.cpp
@@ -395,7 +395,8 @@ bool waybar::modules::Network::checkInterface(std::string name) {
return config_["interface"].asString() == name ||
wildcardMatch(config_["interface"].asString(), name);
}
- return false;
+ spdlog::debug("ifname_: {}; name: {}", ifname_, name);
+ return ifname_ == name;
}
void waybar::modules::Network::clearIface() { alternatively to avoid overloading diff --git a/src/modules/network.cpp b/src/modules/network.cpp
index 74b54d9..b9a0e16 100644
--- a/src/modules/network.cpp
+++ b/src/modules/network.cpp
@@ -41,7 +41,7 @@ waybar::modules::Network::readBandwidthUsage() {
std::string ifacename;
iss >> ifacename; // ifacename contains "eth0:"
ifacename.pop_back(); // remove trailing ':'
- if (!checkInterface(ifacename)) {
+ if (ifacename != ifname_) {
continue;
}
|
For me the bandwidth did not show up correctly on wlan0 as described here and #610. I built a go custom app based on i3-netusage and uploaded it to Github. Maybe it helps you as well :) I tried to add autodetection of the gateway interface. Not sure if it does work correctly. Just had some late night coding time :D |
'Network speed' is working on 0.9.8.
I don't know why. Now (0.9.9) always static 0 bit/s (or octet). Maybe I can try something step-by-step? Let me know, please.
My config:
And, and, and. When "format-wifi" - nothing is displayed (empty, even without icons).
The text was updated successfully, but these errors were encountered: