-
-
Notifications
You must be signed in to change notification settings - Fork 717
feat(net): interface discovery #2025
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2025 +/- ##
=========================================
- Coverage 7.83% 7.80% -0.04%
=========================================
Files 142 142
Lines 10299 10340 +41
=========================================
Hits 807 807
- Misses 9492 9533 +41
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have often thought what it would take to make the network module automatically detect interfaces. And after reviewing this, I came to the conclusion that it is really hard.
You did a good job.
I think we should also check that interfaces aren't virtual when we search for wired or wireless interfaces to not accidentally select the loopback or tunnel interfaces.
As I noted in my comment below, this doesn't have to be perfect and take every edge case into account, it just has to be good enough to work for most people with "normal" setups and your code largely does that. We can always refine the code in the future if people report it not behaving as expected for them.
e0af364
to
7465e6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. Still need to actually test it though ;)
@patrick96 how would i go about testing this? |
7465e6b
to
f33df1c
Compare
Oh sorry. I meant I still need to test it. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@patrick96 did you ever get around to testing this? |
@patrick96 bump |
@patrick96 I would really love to see this go through, there's some way that I can help with testing it. |
@patrick96 Really looking forward to this addition.^^ |
While we wait for this PR to go through, what a ended up doing was setting up my config file like
and on |
@patrick96 ping again |
Hey guys :), I suppose to tagging me here is a typo 😅, if possible please change it 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay
I tested the changes and everything seems to work fine.
I also added some small suggestions for error handling.
We recently started tracking the changelog directly in the repo (https://github.com/polybar/polybar/blob/master/CONTRIBUTING.md#changelog). Please add these changes to the changelog (you may need to rebase and force push for this).
I do have some thoughts about the default behavior of the module. But this doesn't have to happen in this PR.
Right now interface-type
is required if interface
is not specified.
I think, the module should work even if neither is specified. In that case it should just pick a wired or wireless interface.
If you want to work on this, let me know, otherwise I'll open an issue and let someone else take a stab at it.
f33df1c
to
b91d67b
Compare
I think it would be good to leave the no-options config to a separate PR. imo that should try to find whichever interface is "active" which seems out of scope of this. |
b91d67b
to
4b6b690
Compare
4b6b690
to
0af0364
Compare
You're right. I also didn't really think about the "active" part. I would have just taken the first available non-virtual interface. I am going to open a new issue for this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good now.
Thanks! 🚀
I have decided against adding active interface detection. Most use cases for that can be covered with three modules: [module/net-base]
format-disconnected =
...
[module/net-wired]
inherit = module/net-base
interface-type = wired
[module/net-wireless]
inherit = module/net-base
interface-type = wireless This will only show active interfaces as well. |
When it will be released? |
Don't know yet |
Currently (v3.5.6) need the patch from polybar/polybar#2025
Allows you to specify
interface-type=wired/wireless
instead ofinterface=ifname
Closes #339