From a5616fdad821b02ca224d169e993f934747e2f65 Mon Sep 17 00:00:00 2001 From: "J.M. Dana" Date: Sat, 21 Feb 2015 14:34:54 +0000 Subject: Provides information about multiple devices --- py3status/modules/bluetooth.py | 15 ++++++++++----- 1 file 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" -- cgit v1.3