From a969fc0b7596b8b44ed0963f03b1ed4899fd161f Mon Sep 17 00:00:00 2001 From: WORD559 Date: Sat, 1 Sep 2018 14:40:18 +0100 Subject: [PATCH] Added parameter to pulseaudio module that allows users to specify the percentage change of the volume when scrolling on the module. --- bumblebee/modules/pulseaudio.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/pulseaudio.py b/bumblebee/modules/pulseaudio.py index 2b4fd05..f6b33cf 100644 --- a/bumblebee/modules/pulseaudio.py +++ b/bumblebee/modules/pulseaudio.py @@ -6,6 +6,7 @@ Aliases: pasink (use this to control output instead of input), pasource Parameters: * pulseaudio.autostart: If set to "true" (default is "false"), automatically starts the pulseaudio daemon if it is not running + * pulseaudio.percent_change: How much to change volume by when scrolling on the module (default is 2%) Requires the following executable: * pulseaudio @@ -33,6 +34,13 @@ class Module(bumblebee.engine.Module): bumblebee.util.execute("pulseaudio --start") except Exception: pass + try: + percent_change = int(self.parameter("percent_change","2%").strip("%")) + except: + percent_change = 2 + if percent_change < 0 or percent_change > 100: + percent_change = 2 + self._left = 0 self._right = 0 @@ -51,8 +59,8 @@ class Module(bumblebee.engine.Module): events = [ {"type": "mute", "action": "toggle", "button": bumblebee.input.LEFT_MOUSE}, - {"type": "volume", "action": "+2%", "button": bumblebee.input.WHEEL_UP}, - {"type": "volume", "action": "-2%", "button": bumblebee.input.WHEEL_DOWN}, + {"type": "volume", "action": "+{percent}%".format(percent=percent_change), "button": bumblebee.input.WHEEL_UP}, + {"type": "volume", "action": "-{percent}%".format(percent=percent_change), "button": bumblebee.input.WHEEL_DOWN}, ] for event in events: