* Fix pycodestyle errors
W503 is condracting PEP-8 and was added to the default ignore list by
pycodestyle developers
* Use setup.cfg for pycodestyle ignore parameters
Addresses #651 (kind of). Appending ignores to the default list prevents
us from getting warnings that we don't care about.
* W503 is not in the default ignore list in 2.4.0
When we move the sink of an application, it can fail, then pacmd
print error message on stdout, breaking the i3pystatus json.
This changes hides these messages since their are not really usefull.
When we have multiple sinks, this change allows to have all/some of them
available in i3pystatus and to identify which one is currently the
default. Also it allows to configure if we want that the hook
change_sink move all inputs to the new sink or not.
subprocess.Popen() does not implicitly wait() on the child process.
This leads to transient zombie pactl processes which are only reaped
as new processes are spawned.
Use synchronous subprocess communication to collect child process
return codes immediately and allow them to exit.
Volume changes may occur externally (e.g. through pactl bound to media
keys) or through mouse interaction. The new volume is received
asynchronously but can only be outputted at the next status poll,
causing a small delay.
Introduce Module.send_output() to allow a module to send its output
without delay. Invoke this method in the Pulseaudio sink info callback.
Make sink a property which checks which sink is currently active.
Use pactl to control volumes which gets standard insalled with libpulse
which is already a requirement.
This commit removes and replaces all the old methods 'on_*' by settings
with the same name. The old methods were renamed into more explicit names that can be used for the callbacks like "next_song","mute" etc...
For instance, you can test with:
status.register("clock",
format=[
("Format 0",'Europe/London'),
("%a %-d Format 1",'Europe/Dublin'),
"%a %-d %b %X format 2",
("%a %-d %b %X format 3", 'Europe/Paris'),
],
on_leftclick= ["urxvtc"] , # launch urxvtc on left click
on_rightclick= ["scroll_format", 2] , # update format by steps of 2
log_level=logging.DEBUG,
)
This way much code could be removed from other modules, though I did it only for the clock module here.
The alsa and pulseaudio modules now support an optional "format_muted"
setting. If provided, it will be used instead of "format" when the audio
is muted.