diff --git a/bumblebee/input.py b/bumblebee/input.py index 40fba85..5fb3032 100644 --- a/bumblebee/input.py +++ b/bumblebee/input.py @@ -5,9 +5,12 @@ import json import uuid import time import select +import logging import threading import bumblebee.util +log = logging.getLogger(__name__) + LEFT_MOUSE = 1 MIDDLE_MOUSE = 2 RIGHT_MOUSE = 3 @@ -24,6 +27,7 @@ def read_input(inp): """Read i3bar input and execute callbacks""" epoll = select.epoll() epoll.register(sys.stdin.fileno(), select.EPOLLIN) + log.debug("starting click event processing") while inp.running: if is_terminated(): return @@ -36,14 +40,18 @@ def read_input(inp): line = "[" while line.startswith("["): line = sys.stdin.readline().strip(",").strip() + log.debug("new event: {}".format(line)) inp.has_event = True try: event = json.loads(line) if "instance" in event: inp.callback(event) inp.redraw() - except ValueError: - pass + else: + log.debug("field 'instance' missing in input, not processing the event") + except ValueError as e: + log.debug("failed to parse event: {}".format(e)) + log.debug("exiting click event processing") epoll.unregister(sys.stdin.fileno()) epoll.close() inp.has_event = True