diff options
| -rw-r--r-- | py3status/modules/bluetooth.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/py3status/modules/bluetooth.py b/py3status/modules/bluetooth.py index 9840794..00fdb84 100644 --- a/py3status/modules/bluetooth.py +++ b/py3status/modules/bluetooth.py @@ -43,12 +43,17 @@ class Py3status: p1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE) p2 = subprocess.Popen(cmd2, stdin=p1.stdout, stdout=subprocess.PIPE) - mac = p2.communicate()[0].strip().decode("utf-8") + macs = p2.communicate()[0].strip().decode("utf-8").split() + + if macs != []: + names = [] + for mac in macs: + cmd3 = shlex.split("hcitool name %s" % mac) + p3 = subprocess.Popen(cmd3, stdout=subprocess.PIPE) + names.append(p3.communicate()[0].strip().decode("utf-8")) + + output += "|".join(names) - if mac != "": - cmd3 = shlex.split("hcitool name %s" % mac) - p3 = subprocess.Popen(cmd3, stdout=subprocess.PIPE) - output += p3.communicate()[0].strip().decode("utf-8") color = self.color_good or i3s_config['color_good'] else: output += "OFF" |
