From f748f8a4d8d428241b73554e0a1d29ca44d91aef Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Sat, 13 Sep 2014 23:30:30 +0200 Subject: [PATCH] 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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↲ --- i3pystatus/alsa.py | 10 +++++----- i3pystatus/clock.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/i3pystatus/alsa.py b/i3pystatus/alsa.py index e147106..9da543b 100644 --- a/i3pystatus/alsa.py +++ b/i3pystatus/alsa.py @@ -25,7 +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"), + ("increment", "integer percentage of max volume to in/decrement volume on mousewheel"), "muted", "unmuted", "color_muted", "color", "channel" @@ -87,13 +87,13 @@ class ALSA(IntervalModule): def on_rightclick(self): if self.has_mute: - muted = self.alsamixer.getmute()[self.channel] - self.alsamixer.setmute( not muted ) + muted = self.alsamixer.getmute()[self.channel] + self.alsamixer.setmute(not muted) def on_upscroll(self): vol = self.alsamixer.getvolume()[self.channel] - self.alsamixer.setvolume( vol + self.increment) + self.alsamixer.setvolume(min(100, vol + self.increment)) def on_downscroll(self): vol = self.alsamixer.getvolume()[self.channel] - self.alsamixer.setvolume( vol - self.increment) + self.alsamixer.setvolume(max(0, vol - self.increment)) diff --git a/i3pystatus/clock.py b/i3pystatus/clock.py index dde491a..db63893 100644 --- a/i3pystatus/clock.py +++ b/i3pystatus/clock.py @@ -59,7 +59,7 @@ class Clock(IntervalModule): else: 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 = { "full_text": output,