home · contact · privacy
Add aliases to mail setup.
[config] / bin / i3status_wrapper.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Inspired by http://code.stapelberg.de/git/i3status/tree/contrib/wrapper.py
5
6 import sys
7 import json
8 import subprocess 
9
10 def print_nonbuffered(message):
11     sys.stdout.write(message)
12     sys.stdout.flush()
13
14 if __name__ == '__main__':
15     print_nonbuffered(sys.stdin.readline())
16     print_nonbuffered(sys.stdin.readline())
17     while True:
18         line, prefix = sys.stdin.readline(), ''
19         if line.startswith(','):
20             line, prefix = line[1:], ','
21         j = json.loads(line)
22         if '1' == subprocess.getoutput('xset q | grep LED')[65]:
23             j.insert(len(j), {'full_text' : 'CAPS',
24                               'separator_block_width': 40,
25                               'color': '#FF0000'})
26         print_nonbuffered(prefix+json.dumps(j))