From de01d96b915b8a7698f082970dd0ca51ae81afef Mon Sep 17 00:00:00 2001 From: Florian Eich Date: Mon, 30 Nov 2020 23:21:21 +0100 Subject: [PATCH] Change iw call in module nic from link to info --- bumblebee_status/modules/core/nic.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bumblebee_status/modules/core/nic.py b/bumblebee_status/modules/core/nic.py index 667cffa..70ea1cf 100644 --- a/bumblebee_status/modules/core/nic.py +++ b/bumblebee_status/modules/core/nic.py @@ -134,13 +134,15 @@ class Module(core.module.Module): widget.set("state", state) def get_ssid(self, intf): - if self._iswlan(intf) and not self._istunnel(intf) and self.iw: - ssid = util.cli.execute("{} dev {} link".format(self.iw, intf)) - found_ssid = re.findall("SSID:\s(.+)", ssid) - if len(found_ssid) > 0: - return found_ssid[0] - else: - return "" + if not self._iswlan(intf) or self._istunnel(intf) or not self.iw: + return "" + + iw_info = util.cli.execute("{} dev {} info".format(self.iw, intf)) + for line in iw_info.split("\n"): + match = re.match("^\s+ssid\s(.+)$", line) + if match: + return match.group(1) + return ""