-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace pacmd calls with pactl to support Pipewire [final version] #836
Conversation
@terminalmage do you have the rights to merge this PR? :) |
Co-authored-by: EgZvor <[email protected]>
# Not all applications can be moved and pulseaudio, and when | ||
# this fail pacmd print error messaging | ||
with open(os.devnull, 'w') as devnull: | ||
subprocess.call(command.split(), stdout=devnull) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the code came from #552. Since this PR uses the method _call_pactl
instead that internally uses subprocess.check_output
, the messages on stdout that could come from pactl
will always be discarded.
i3pystatus/pulseaudio/__init__.py
Outdated
def _call_pactl(self, pactl_arguments): | ||
try: | ||
output = subprocess.check_output( | ||
["pactl"] + [str(arg) for arg in pactl_arguments], | ||
universal_newlines=True) | ||
return output | ||
except Exception as exc: | ||
self.logger.exception("Error while executing pactl") | ||
self.output = {"color": self.color_error, "full_text": "Error while executing pactl"} | ||
self.send_output() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every call of the functions subprocess.check_output
or subprocess.call
of this module were replaced in this PR by self._call_pactl
.
This method call the pactl
command with its arguments using subprocess.check_output()
internally. The outputs are either treated by the callee or simply ignored.
If an error occurs, we update self.output
with a minimal message and we notify the change using self.send_output()
. The full stacktrace is available in the file logs (I checked) since self.logger.exception
is now used.
@terminalmage let me know if the changes that I made are corresponding to what you had in mind 🙂 FYI, when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one remaining small nitpick.
Co-authored-by: EgZvor <[email protected]>
@terminalmage Thanks for the review! Let me know if I need to fix something else 🙂 |
Thanks! Merged it just now. |
Hello,
I continued the work from @EgZvor (thank you!) in #818 and patched the remaining issue with default-sink in pactl.
I used this version for the last two weeks so far. I think this PR is directly megeable @enkore 😉
Fixes: #810
Best regards,
hasB4K