[core/input] Ugly hack for responsiveness

Somehow, the fix in the previous commit didn't work, it seems that
sometimes epoll() doesn't trigger, even if there is more data in
sys.stdin. I'm sure I'm doing something horribly wrong here.

Anyhow, as a quick fix, check for the open bracket to be sure to not
buffer the first event too long.
This commit is contained in:
Tobi-wan Kenobi 2016-12-17 08:04:21 +01:00
parent f6be25bc73
commit 220bb9bf60

View file

@ -18,15 +18,17 @@ def read_input(inp):
"""Read i3bar input and execute callbacks"""
epoll = select.epoll()
epoll.register(sys.stdin.fileno(), select.EPOLLIN)
f = open("/tmp/bee.log", "a")
while inp.running:
for thread in threading.enumerate():
if thread.name == "MainThread" and not thread.is_alive():
return
events = epoll.poll(1)
for fileno, event in events:
line = sys.stdin.readline().strip(",").strip()
line = "["
while "[" in line:
line = sys.stdin.readline().strip(",").strip()
inp.has_event = True
try:
event = json.loads(line)