8000 Detect network interface removal · Issue #1163 · polybar/polybar · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Detect network interface removal #1163

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

Closed
pfouto opened this issue Apr 13, 2018 · 6 comments
Closed

Detect network interface removal #1163

pfouto opened this issue Apr 13, 2018 · 6 comments

Comments

@pfouto
Copy link
pfouto commented Apr 13, 2018

I am using a USB to Ethernet adapter, since my laptop does not have an ethernet port.

If I disconnect the ethernet cable from the adapter, the state of the network interface is set to down, which changes the polybar network module normally.

However, if I disconnected the adapter from the laptop without first disconnecting the ethernet cable from the adapter (i.e, the network interface disappears, without first changing its state do down) the polybar network module stops updating itself, continuing to display the last state before the adapter was removed instead of displaying the disconnected format.

@pfouto pfouto changed the title Detect network intertace removal Detect network interface removal Apr 13, 2018
@patrick96
Copy link
Member

What does the current behaviour look like in the polybar output? Does polybar issue some kind of warning when you do that?

@pfouto
Copy link
Author
pfouto commented Apr 14, 2018

Yes, it seems to be executing the following code:

https://github.com/jaagr/polybar/blob/0a8a326730248131880430596c83a8529c0ffe38/src/modules/network.cpp#L87-L90

I'm not familiar with the code, but I suppose setting m_connected to false inside this code block is what I'm looking for. I'm not sure what that return false implies though.

@patrick96
Copy link
Member

Yeah most likely that's what we need to do. As far as I can tell, the return value of the update function is never used. I'll open a PR

patrick96 added a commit to patrick96/polybar that referenced this issue Apr 16, 2018
patrick96 added a commit that referenced this issue Jul 23, 2018
Breaking Changes:

* `0 < label-NAME-maxlen < 3` will now throw an exception and disable the containing module, if ellipsis is enabled for that label. (#1198)

Changelog:

Deprecations:
* `internal/volume` is now called `internal/alsa` (#967)
* temperature: The `%temperature%` is deprecated in favor of `%temperature-c%`(#897)
* mpd: `icon-repeatone` is deprecated in favor of `icon-single` (#1295), see #1279

Features:
* feat(mpd): Add support for icon-consume (#861)
* feat(bspwm): Add workspace separator (#942) 
* feat(i3): Add workspace separator (#938), see #929
* feat(build): Make polybar build on FreeBSD (#931, polybar/xpp#8), see #239
* feat(volume): Add pulseaudio backend (#779)
* feat(script): Add %pid% token for tail commands (#934)
* feat(temp): Add temperature tokens without unit (#897)
* feat(memory): Add memory used/free ramp (#1038), see #1037
* feat(memory): Add swap tokens (#1018) 
* feat(net): Add unknown-as-up option (#1077), see #457
* feat(config): Support fractional size and offset (#972), see #953
* feat(xwindow): Add label-empty (#1136)
* feat(battery): Add animation-discharging (analog to animation-charging) (#1190)
* feat(config): Support pixel offset for bar size and offset values (#1224)
* feat(mpd): Add `%album-artist%` token (#1263)
* feat(net): Add local_ip6 token (#1239), see #1234
* feat(net): Add nl80211 support (#1009), see #277

Fixes:
* fix(mpd): Wrong elapsed time when after standby (#921), see #915
* fix(config): Wrong min, maxlen when using the same token multiple times (#974), see #971
* fix(battery): use power_now correctly (#958), see #928
* fix(mpd): Crash when mpd isn't running (#983), see #979
* fix(xworkspaces): Respect 'enable-scroll' (#1002)
* fix(xbacklight): Respect 'enable-scroll' (#1014)
* fix(build): support xcb-proto >=1.13 (polybar/xpp#11), see #973
* fix(mpd): Respect MPD_HOST env variable (#1025), see #1007
* fix(i3): Reconnect i3 IPC socket on restart/error (#1099), see #762
* fix(cursor): Occasional crash on mouseover (#1124), see #1117
* fix(net): Mark 'not connected' on querying failure (#1171), see #1163
* fix(gcc): Fix -Wstringop-truncation warning (#1216, polybar/i3ipcpp#7), see #1215
* fix(builder): Don't truncate colors with same channels (#1217), see #1183
* fix(bspwm): Consistent behavior when scrolling through multiple desktops (#986), see #981
* fix(builder): Respect label-ellipsis option (#1198), see #1194
@edward-shen
Copy link
edward-shen commented Nov 17, 2018

It looks like it might not have been solved. I'm current running v.3.2.1 and the behavior still exists.

I'm currently using a USB Type-C to Ethernet adapter that shows up as a enp62s0u1. Connecting it before starting polybar will have it show properly up. Disconnecting the adapter will have polybar emit a "Failed to query interface" message, and will continue to render the interface despite no longer having access to it.

When the device is reconnected, polybar will correctly recognize that the interface and resume proper behavior.

I think I have a fix, give me some time and I'll make a PR shortly.

edward-shen added a commit to edward-shen/polybar that referenced this issue Nov 18, 2018
network module now assumes disconnected interface on failed query.
edward-shen added a commit to edward-shen/polybar that referenced this issue Jan 24, 2019
network module now assumes disconnected interface on failed query.
edward-shen added a commit to edward-shen/polybar that referenced this issue Apr 7, 2019
network module now assumes disconnected interface on failed query.
edward-shen added a commit to edward-shen/polybar that referenced this issue Apr 12, 2019
network module now assumes disconnected interface on failed query.
@MTBorg
Copy link
Contributor
MTBorg commented Dec 14, 2019

I'm still experiencing this, any fix?

doronbehar pushed a commit to doronbehar/polybar that referenced this issue Mar 19, 2020
network module now assumes disconnected interface on failed query.
doronbehar added a commit to doronbehar/polybar that referenced this issue Mar 19, 2020
* network-interfaces-fixes:
  documented updating network tokens even if disconnected
  removed duplicated disconnected label
  Fixes polybar#1164.
  Fixes polybar#1163. network module now assumes disconnected interface on failed query.
@origamisith
Copy link

I still have this issue with a USB-C to ethernet adapter on my laptop. The log outputs "Failed to query interface 'enp0s20fu7'" but polybar doesn't update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
0