[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:
parent
6d47240d6a
commit
a3f4b0aa6d
1 changed files with 8 additions and 4 deletions
|
@ -14,15 +14,19 @@ RIGHT_MOUSE = 3
|
||||||
WHEEL_UP = 4
|
WHEEL_UP = 4
|
||||||
WHEEL_DOWN = 5
|
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):
|
def read_input(inp):
|
||||||
"""Read i3bar input and execute callbacks"""
|
"""Read i3bar input and execute callbacks"""
|
||||||
epoll = select.epoll()
|
epoll = select.epoll()
|
||||||
epoll.register(sys.stdin.fileno(), select.EPOLLIN)
|
epoll.register(sys.stdin.fileno(), select.EPOLLIN)
|
||||||
f = open("/tmp/bee.log", "a")
|
|
||||||
while inp.running:
|
while inp.running:
|
||||||
for thread in threading.enumerate():
|
if is_terminated():
|
||||||
if thread.name == "MainThread" and not thread.is_alive():
|
return
|
||||||
return
|
|
||||||
|
|
||||||
events = epoll.poll(1)
|
events = epoll.poll(1)
|
||||||
for fileno, event in events:
|
for fileno, event in events:
|
||||||
|
|
Loading…
Reference in a new issue