From a3f4b0aa6de71e9f12514c5bf52e4157e0118c34 Mon Sep 17 00:00:00 2001 From: Tobi-wan Kenobi Date: Sun, 26 Feb 2017 09:13:44 +0100 Subject: [PATCH] [input] Cleaner termination logic, also, remove /tmp/bee.log Accidentially opened file /tmp/bee.log, without writing anything to it. --- bumblebee/input.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bumblebee/input.py b/bumblebee/input.py index 6bbdc3d..1678b2e 100644 --- a/bumblebee/input.py +++ b/bumblebee/input.py @@ -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: