diff options
Diffstat (limited to '')
-rw-r--r-- | i3pystatus/.config/i3pystatus/conf.py | 11 | ||||
-rw-r--r-- | i3pystatus/.config/i3pystatus/headset.py | 21 |
2 files changed, 32 insertions, 0 deletions
diff --git a/i3pystatus/.config/i3pystatus/conf.py b/i3pystatus/.config/i3pystatus/conf.py index 1d7f4c5..1a09983 100644 --- a/i3pystatus/.config/i3pystatus/conf.py +++ b/i3pystatus/.config/i3pystatus/conf.py @@ -226,6 +226,17 @@ status.register("text", # text="|", # hints = {"separator": False, "separator_block_width": 0},) +status.register("shell", + command="python ~/.config/i3pystatus/headset.py", + interval=1, + hints = {"separator": False, "separator_block_width": 0},) + +status.register("text", + text="|", + hints = {"separator": False, "separator_block_width": 0},) + + + status.register("redshift", hints = {"separator": False, "separator_block_width": 0},) diff --git a/i3pystatus/.config/i3pystatus/headset.py b/i3pystatus/.config/i3pystatus/headset.py new file mode 100644 index 0000000..8668300 --- /dev/null +++ b/i3pystatus/.config/i3pystatus/headset.py @@ -0,0 +1,21 @@ +import json + +try: + with open('/tmp/parrotZikBattery') as json_data: + data = json.load(json_data) + + try: + if "data" in data: + out = str(data["data"]["level"])+"% ("+data["data"]["state"]+")" + print(out) + elif "error" in data: + print(data["error"]) + except TypeError: + print("X") +except OSError as e: + if e.errno == 2: + print("X") + else: + print(e) + + |