[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_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():
|
||||
return
|
||||
if is_terminated():
|
||||
return
|
||||
|
||||
events = epoll.poll(1)
|
||||
for fileno, event in events:
|
||||
|
|
Loading…
Reference in a new issue