vpn_status module: fix changed dbus signal handler signature
* vpn_status module: fix changed dbus signal handler signature
backward compatible version of thx to
* vpn_status module: initialize active connections on start
@@ -72,17 +72,25 @@ class Py3status:
manager = bus.get(".NetworkManager")
manager.onPropertiesChanged = self._vpn_signal_handler
+ # initialize active connections, some of them might be VPNs
+ self.active = manager.ActiveConnections
+
# Loop forever
loop.run()
- def _vpn_signal_handler(self, args):
+ def _vpn_signal_handler(self, *args):
"""Called on NetworkManager PropertiesChanged signal"""
# Args is a dictionary of changed properties
# We only care about changes in ActiveConnections
active = "ActiveConnections"
# Compare current ActiveConnections to last seen ActiveConnections
- if active in args and sorted(self.active) != sorted(args[active]):
- self.active = args[active]
+ for arg in args:
+ if (
+ isinstance(arg, dict)
+ and active in arg
+ and sorted(self.active) != sorted(arg[active])
+ ):
+ self.active = arg[active]
self.py3.update()
def _get_vpn_status(self):
