i3 next branch send click events on mouse wheel up/down. This patch allows to change the alsa volume with the mousewheel when hovering the alsa indicator
This commit is contained in:
parent
fb14041381
commit
000bdc6978
@ -25,6 +25,7 @@ class ALSA(IntervalModule):
|
|||||||
("mixer", "ALSA mixer"),
|
("mixer", "ALSA mixer"),
|
||||||
("mixer_id", "ALSA mixer id"),
|
("mixer_id", "ALSA mixer id"),
|
||||||
("card", "ALSA sound card"),
|
("card", "ALSA sound card"),
|
||||||
|
("increment","integer percentage of max volume to in/decrement volume on mousewheel"),
|
||||||
"muted", "unmuted",
|
"muted", "unmuted",
|
||||||
"color_muted", "color",
|
"color_muted", "color",
|
||||||
"channel"
|
"channel"
|
||||||
@ -40,6 +41,7 @@ class ALSA(IntervalModule):
|
|||||||
mixer_id = 0
|
mixer_id = 0
|
||||||
card = 0
|
card = 0
|
||||||
channel = 0
|
channel = 0
|
||||||
|
increment = 5
|
||||||
|
|
||||||
alsamixer = None
|
alsamixer = None
|
||||||
has_mute = True
|
has_mute = True
|
||||||
@ -79,3 +81,11 @@ class ALSA(IntervalModule):
|
|||||||
"full_text": output_format.format(**self.fdict),
|
"full_text": output_format.format(**self.fdict),
|
||||||
"color": self.color_muted if muted else self.color,
|
"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)
|
@ -27,6 +27,10 @@ class Module(SettingsBase):
|
|||||||
self.on_leftclick()
|
self.on_leftclick()
|
||||||
elif button == 3: # Right mouse button
|
elif button == 3: # Right mouse button
|
||||||
self.on_rightclick()
|
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):
|
def move(self, position):
|
||||||
self.position = position
|
self.position = position
|
||||||
@ -38,6 +42,11 @@ class Module(SettingsBase):
|
|||||||
def on_rightclick(self):
|
def on_rightclick(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def on_upscroll(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def on_downscroll(self):
|
||||||
|
pass
|
||||||
|
|
||||||
class IntervalModuleMeta(type):
|
class IntervalModuleMeta(type):
|
||||||
"""Add interval setting to `settings` attribute if it does not exist."""
|
"""Add interval setting to `settings` attribute if it does not exist."""
|
||||||
|
Loading…
Reference in New Issue
Block a user