summaryrefslogtreecommitdiffstats
path: root/py3status/modules/bluetooth.py
diff options
context:
space:
mode:
authorJ.M. Dana <jmdana@gmail.com>2015-02-21 14:34:54 +0000
committerJ.M. Dana <jmdana@gmail.com>2015-02-21 14:34:54 +0000
commita5616fdad821b02ca224d169e993f934747e2f65 (patch)
tree99730a4abecd5566e8d9db16fdd8399dffb82275 /py3status/modules/bluetooth.py
parent2dee830be88dea42e92c445abec37d058a28ef1b (diff)
Provides information about multiple devices
Diffstat (limited to 'py3status/modules/bluetooth.py')
-rw-r--r--py3status/modules/bluetooth.py15
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"