[input] Cleaner termination logic, also, remove /tmp/bee.log

Accidentially opened file /tmp/bee.log, without writing anything to it.
This commit is contained in:
Tobi-wan Kenobi 2017-02-26 09:13:44 +01:00
parent 6d47240d6a
commit a3f4b0aa6d

View file

@ -14,14 +14,18 @@ RIGHT_MOUSE = 3
WHEEL_UP = 4
WHEEL_DOWN = 5
def is_terminated():
for thread in threading.enumerate():
if thread.name == "MainThread" and not thread.is_alive():
return True
return False
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():
if is_terminated():
return
events = epoll.poll(1)