pulseaudio: show correct sink volume on default output changes
on sinkInfo callbacks, the default sink now has highest priority. That fixes an issue that the volume indicator is not updated when the changes the default output to another devices. added PA_SINK_IDLE as valid state. PA_SINK_RUNNING is only true if any sound output is happening on sink switch. Indicator should also update when no sound is being played.
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
#include "modules/pulseaudio.hpp"
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <numeric>
|
||||
|
||||
waybar::modules::Pulseaudio::Pulseaudio(const std::string &id, const Json::Value &config)
|
||||
: ALabel(config, "pulseaudio", id, "{volume}%") {
|
||||
@ -52,6 +54,7 @@ const std::vector<std::string> waybar::modules::Pulseaudio::getPulseIcon() const
|
||||
std::string nameLC = backend->getSinkPortName() + backend->getFormFactor();
|
||||
std::transform(nameLC.begin(), nameLC.end(), nameLC.begin(), ::tolower);
|
||||
for (auto const &port : ports) {
|
||||
spdlog::trace("Port: {}", nameLC);
|
||||
if (nameLC.find(port) != std::string::npos) {
|
||||
if (sink_muted) {
|
||||
res.emplace_back(port + "-muted");
|
||||
@ -63,6 +66,10 @@ const std::vector<std::string> waybar::modules::Pulseaudio::getPulseIcon() const
|
||||
if (sink_muted) {
|
||||
res.emplace_back("default-muted");
|
||||
}
|
||||
spdlog::trace("Ports:");
|
||||
for (auto const &item : res) {
|
||||
spdlog::trace(" {}", item);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user