greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.88k stars 475 forks source link

networkmanager: When connected to VPN, wifi shows twice #1016

Closed xkonni closed 3 years ago

xkonni commented 3 years ago

Hey everyone!

Just a slight issue I've experienced with the networkmanager block. When connected to my wifi it looks like this: image

However when I connect to a VPN, it shows the wifi status twice: image

I would rather think 1x wifi + 1x vpn should be sufficient, but maybe it's working as intended?

Thank you for your time!

ammgws commented 3 years ago

Hmm, does it show up twice on DBus as well?

xkonni commented 3 years ago

Good question. My dbus experience is rather limited, trying to figure it out with this guide: http://cheesehead-techblog.blogspot.com/2012/09/dbus-tutorial-fun-with-network-manager.html

when not connected to vpn

Active connections

$ dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.DBus.Properties.Get string:"org.freedesktop.NetworkManager" string:"ActiveConnections"
method return time=1612618162.825471 sender=:1.2 -> destination=:1.506 serial=23161 reply_serial=2
   variant       array [
         object path "/org/freedesktop/NetworkManager/ActiveConnection/10"
      ]

APNs

$ dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/ActiveConnection/10 org.freedesktop.DBus.Properties.Get string:"org.freedesktop.NetworkManager.Connection.Active" string:"SpecificObject"
method return time=1612618447.422419 sender=:1.2 -> destination=:1.515 serial=23264 reply_serial=2
   variant       object path "/org/freedesktop/NetworkManager/AccessPoint/230"

APN name

$ dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/AccessPoint/230 org.freedesktop.DBus.Properties.Get string:"org.freedesktop.NetworkManager.AccessPoint" string:"Ssid"
method return time=1612618535.957202 sender=:1.2 -> destination=:1.517 serial=23288 reply_serial=2
   variant       array of bytes "omnomnom"

when connected to VPN

Active Connections

$ dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.DBus.Properties.Get string:"org.freedesktop.NetworkManager" string:"ActiveConnections"
method return time=1612618645.935493 sender=:1.2 -> destination=:1.524 serial=23729 reply_serial=2
   variant       array [
         object path "/org/freedesktop/NetworkManager/ActiveConnection/14"
         object path "/org/freedesktop/NetworkManager/ActiveConnection/13"
         object path "/org/freedesktop/NetworkManager/ActiveConnection/10"
      ]

APNs

$ for i in 10 13 14; do dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/ActiveConnection/$i org.freedesktop.DBus.Properties.Get string:"org.freedesktop.NetworkManager.Connection.Active" string:"SpecificObject"; done
method return time=1612618721.525636 sender=:1.2 -> destination=:1.525 serial=23768 reply_serial=2
   variant       object path "/org/freedesktop/NetworkManager/AccessPoint/230"
method return time=1612618721.533609 sender=:1.2 -> destination=:1.526 serial=23769 reply_serial=2
   variant       object path "/org/freedesktop/NetworkManager/ActiveConnection/10"
method return time=1612618721.541261 sender=:1.2 -> destination=:1.527 serial=23770 reply_serial=2
   variant       object path "/"

APN name

$ for i in 10 230; do dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/AccessPoint/230 org.freedesktop.DBus.Properties.Get string:"org.freedesktop.NetworkManager.AccessPoint" string:"Ssid"; done
method return time=1612618813.292882 sender=:1.2 -> destination=:1.528 serial=23807 reply_serial=2
   variant       array of bytes "omnomnom"
method return time=1612618813.300643 sender=:1.2 -> destination=:1.529 serial=23808 reply_serial=2
   variant       array of bytes "omnomnom"

So apparently, yes. Even though ActiveConnection/10 technically is not an APN, it does show the SSID.

ammgws commented 3 years ago

Hmm, not sure what we can do about it...

xkonni commented 3 years ago

they are different in the VPN case, one being an AccessPoint (230), the other an ActiveConnection (10). In the no-vpn-case it's an AccessPoint. Are there any cases where the ssid of an ActiveConnection should be shown?

ammgws commented 3 years ago

OK I think I understand what you mean: if SSID is only relevant for AccessPoint then we could solve this issue by ignoring it for ActiveConnections. If that is always true then it might be worth a shot (assuming it's trivial enough to implement with the current block code)?

Something else that might be worth checking out: is DeviceType mentioned anywhere? You should be able to use something like d-feet to browse the tree easily.

xkonni commented 3 years ago

Right, that's what I meant. Can't be sure if it's needed for other connections though. d-feet is rather helpful, thanks!

About the DeviceType, no, but there is Type.

Wifi connection:

image

VPN connection

image

TUN connection

image

xkonni commented 3 years ago

fixed in https://github.com/greshake/i3status-rust/pull/1099