diff --git a/i3pystatus/alsa.py b/i3pystatus/alsa.py index 2d90413..e8a504b 100644 --- a/i3pystatus/alsa.py +++ b/i3pystatus/alsa.py @@ -25,6 +25,7 @@ class ALSA(IntervalModule): ("mixer", "ALSA mixer"), ("mixer_id", "ALSA mixer id"), ("card", "ALSA sound card"), + ("increment","integer percentage of max volume to in/decrement volume on mousewheel"), "muted", "unmuted", "color_muted", "color", "channel" @@ -40,6 +41,7 @@ class ALSA(IntervalModule): mixer_id = 0 card = 0 channel = 0 + increment = 5 alsamixer = None has_mute = True @@ -79,3 +81,11 @@ class ALSA(IntervalModule): "full_text": output_format.format(**self.fdict), "color": self.color_muted if muted else self.color, } + + def on_upscroll(self): + vol = self.alsamixer.getvolume() + self.alsamixer.setvolume( vol[0] + self.increment) + + def on_downscroll(self): + vol = self.alsamixer.getvolume() + self.alsamixer.setvolume( vol[0] - self.increment) \ No newline at end of file diff --git a/i3pystatus/core/modules.py b/i3pystatus/core/modules.py index a63ddf3..4356e3a 100644 --- a/i3pystatus/core/modules.py +++ b/i3pystatus/core/modules.py @@ -27,6 +27,10 @@ class Module(SettingsBase): self.on_leftclick() elif button == 3: # Right mouse button self.on_rightclick() + elif button == 4: # mouse wheel up + self.on_upscroll() + elif button == 5: # mouse wheel down + self.on_downscroll() def move(self, position): self.position = position @@ -38,6 +42,11 @@ class Module(SettingsBase): def on_rightclick(self): pass + def on_upscroll(self): + pass + + def on_downscroll(self): + pass class IntervalModuleMeta(type): """Add interval setting to `settings` attribute if it does not exist."""