From 1759c33cf30dc1ee2bab71bf79380c626da99d6e Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Wed, 16 Sep 2020 09:13:48 +0200 Subject: [PATCH] [bumblebee] make input delay configurable make the delay before updating the bar after an input event configurable as engine.input_delay. see #702 --- bumblebee-status | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bumblebee-status b/bumblebee-status index d7e8dab..0c1623e 100755 --- a/bumblebee-status +++ b/bumblebee-status @@ -40,7 +40,7 @@ class CommandSocket(object): os.unlink(self.__name) -def handle_input(output, update_lock): +def handle_input(output, config, update_lock): with CommandSocket() as cmdsocket: poll = select.poll() poll.register(sys.stdin.fileno(), select.POLLIN) @@ -69,7 +69,9 @@ def handle_input(output, update_lock): except ValueError: pass - time.sleep(0.2) + delay = float(config.get("engine.input_delay", 0.2)) + if delay > 0: + time.sleep(delay) if update_lock.acquire(blocking=False) == True: core.event.trigger("update", modules.keys(), force=True) core.event.trigger("draw") @@ -102,7 +104,7 @@ def main(): core.input.register(None, core.input.WHEEL_DOWN, "i3-msg workspace next_on_output") update_lock = threading.Lock() - input_thread = threading.Thread(target=handle_input, args=(output, update_lock, )) + input_thread = threading.Thread(target=handle_input, args=(output, config, update_lock, )) input_thread.daemon = True input_thread.start()