From ee81f6198e8a0aacf4176161a1477420c00d3b1e Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Sun, 4 Sep 2022 09:55:33 +0200 Subject: [PATCH] [modules/pulseaudio] rate-limit pulseaudio events attempting a different tack: Reduce the amount of draws that are being emitted by the pulseaudio module to max. 2/s. That hopefully increases reactivity and at the same time keeps flickering to a minimum. see #917 --- bumblebee_status/modules/core/pulseaudio.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bumblebee_status/modules/core/pulseaudio.py b/bumblebee_status/modules/core/pulseaudio.py index c21c577..aa9eb3b 100644 --- a/bumblebee_status/modules/core/pulseaudio.py +++ b/bumblebee_status/modules/core/pulseaudio.py @@ -34,6 +34,7 @@ Requires the following executable: import re import os +import time import logging import functools import threading @@ -126,12 +127,16 @@ class Module(core.module.Module): r, w, e = select.select([proc.stdout], [], [], 1) if not (r or w or e): + self.update2() + core.event.trigger("update", [self.id], redraw_only=True) + core.event.trigger("draw") continue # timeout # whateve we got, use it self.update2() core.event.trigger("update", [self.id], redraw_only=True) core.event.trigger("draw") os.set_blocking(proc.stdout.fileno(), False) + time.sleep(0.5) proc.stdout.read() os.set_blocking(proc.stdout.fileno(), True)