diff options
author | Camil Staps | 2017-10-27 11:02:30 +0200 |
---|---|---|
committer | Camil Staps | 2017-10-27 11:02:30 +0200 |
commit | 1a81c60fdd31c660342865473703018c4e333ed8 (patch) | |
tree | d468d4080a84077457e48482bc6cc37f12b33716 /i3/bin | |
parent | Add push.recurseSubmodules to gitconfig (diff) |
Remove cloogle from i3bar
Diffstat (limited to 'i3/bin')
-rwxr-xr-x | i3/bin/cloogle_stats.py | 13 | ||||
-rwxr-xr-x | i3/bin/i3status.py | 11 |
2 files changed, 10 insertions, 14 deletions
diff --git a/i3/bin/cloogle_stats.py b/i3/bin/cloogle_stats.py index 6bdc0b8..a572207 100755 --- a/i3/bin/cloogle_stats.py +++ b/i3/bin/cloogle_stats.py @@ -1,9 +1,14 @@ #!/usr/bin/env python3 import json import ssl +import sys import time import websocket +def print_and_flush(s): + print(s) + sys.stdout.flush() + def format_query(query): if 'className' in query: return 'class ' + query['className'] @@ -19,18 +24,18 @@ def format_query(query): def on_message(ws, msg): try: - print(format_query(json.loads(msg))) + print_and_flush(format_query(json.loads(msg))) except: pass def on_open(ws): - print('Opened connection.') + print_and_flush('Opened connection.') def on_error(ws, err): - print(err) + print_and_flush(err) def on_close(ws): - print('Lost connection.') + print_and_flush('Lost connection.') time.sleep(3) start() diff --git a/i3/bin/i3status.py b/i3/bin/i3status.py index 1e00e62..a7ec80a 100755 --- a/i3/bin/i3status.py +++ b/i3/bin/i3status.py @@ -29,9 +29,6 @@ def parse_kbdlayout(s): } return [{'full_text': s, 'color': colors[s]}] -def parse_cloogle(s): - return [{'full_text': s}] - def merge_status_items(*args): return [item for sublist in args for item in sublist] @@ -42,24 +39,19 @@ if __name__ == '__main__': i3stat = Popen(['i3status'], stdout=PIPE, bufsize=1, close_fds=True) kbdlayout = Popen(['unbuffer', 'kbdlayout'], stdout=PIPE, bufsize=1, close_fds=True) - cloogle = Popen(['unbuffer', 'cloogle_stats.py'], - stdout=PIPE, bufsize=1, close_fds=True) - # skip i3status header sys.stdout.write(i3stat.stdout.readline()) sys.stdout.write(i3stat.stdout.readline()) stat, kbd, clg = [], [], [] try: - stdouts = [p.stdout for p in [i3stat, kbdlayout, cloogle]] + stdouts = [p.stdout for p in [i3stat, kbdlayout]] while True: fs = select(stdouts, [], [])[0] for f in fs: line = f.readline()[:-1] if f == kbdlayout.stdout: kbd = parse_kbdlayout(line) - elif f == cloogle.stdout: - clg = parse_cloogle(line) elif f == i3stat.stdout: stat = parse_i3stat(line) @@ -69,4 +61,3 @@ if __name__ == '__main__': print(e) i3stat.kill() kbdlayout.kill() - cloogle.kill() |