this commit fixes 2 problems:

-there was a trailing comma in the clock module that would interact badly with i3pystatus & i3bar; i3pystatus seeing the comma would generate the json ** full_text : ["13 september"] ** and then i3bar would only display the last module (one may have to check for i3bar robustness). resulted in having only the clock module displayed
-the 2nd problem was with the alsa module when setting the volume to a number <0 or > 100 then the pyalsa bindings would generate the following error in .xsession-errors

    target_module.on_click(command["button"])↲
  File "/home/teto/i3pystatus/i3pystatus/core/modules.py", line 31, in
  on_click↲
      self.on_upscroll()↲
        File "/home/teto/i3pystatus/i3pystatus/alsa.py", line 95, in
	on_upscroll↲
	    self.alsamixer.setvolume( vol + self.increment)↲
	    alsaaudio.ALSAAudioError: Volume must be between 0 and 100↲
This commit is contained in:
Matthieu Coudron 2014-09-13 23:30:30 +02:00
parent 806ee99e93
commit f748f8a4d8
2 changed files with 6 additions and 6 deletions

View File

@ -25,7 +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"), ("increment", "integer percentage of max volume to in/decrement volume on mousewheel"),
"muted", "unmuted", "muted", "unmuted",
"color_muted", "color", "color_muted", "color",
"channel" "channel"
@ -88,12 +88,12 @@ class ALSA(IntervalModule):
def on_rightclick(self): def on_rightclick(self):
if self.has_mute: if self.has_mute:
muted = self.alsamixer.getmute()[self.channel] muted = self.alsamixer.getmute()[self.channel]
self.alsamixer.setmute( not muted ) self.alsamixer.setmute(not muted)
def on_upscroll(self): def on_upscroll(self):
vol = self.alsamixer.getvolume()[self.channel] vol = self.alsamixer.getvolume()[self.channel]
self.alsamixer.setvolume( vol + self.increment) self.alsamixer.setvolume(min(100, vol + self.increment))
def on_downscroll(self): def on_downscroll(self):
vol = self.alsamixer.getvolume()[self.channel] vol = self.alsamixer.getvolume()[self.channel]
self.alsamixer.setvolume( vol - self.increment) self.alsamixer.setvolume(max(0, vol - self.increment))

View File

@ -59,7 +59,7 @@ class Clock(IntervalModule):
else: else:
dt = datetime.datetime.now() dt = datetime.datetime.now()
output = dt.strftime(self.format[self.current_format_id][0]), output = dt.strftime(self.format[self.current_format_id][0])
self.output = { self.output = {
"full_text": output, "full_text": output,