Support muted icons for pulseaudio devices/ports
This commit is contained in:
parent
0251e25f23
commit
892042eb92
|
@ -42,15 +42,27 @@ static const std::array<std::string, 9> ports = {
|
|||
};
|
||||
|
||||
const std::vector<std::string> waybar::modules::Pulseaudio::getPulseIcon() const {
|
||||
std::vector<std::string> res = {backend->getCurrentSinkName(), backend->getDefaultSourceName()};
|
||||
std::vector<std::string> res;
|
||||
auto sink_muted = backend->getSinkMuted();
|
||||
if (sink_muted) {
|
||||
res.emplace_back(backend->getCurrentSinkName() + "-muted");
|
||||
}
|
||||
res.push_back(backend->getCurrentSinkName());
|
||||
res.push_back(backend->getDefaultSourceName());
|
||||
std::string nameLC = backend->getSinkPortName() + backend->getFormFactor();
|
||||
std::transform(nameLC.begin(), nameLC.end(), nameLC.begin(), ::tolower);
|
||||
for (auto const &port : ports) {
|
||||
if (nameLC.find(port) != std::string::npos) {
|
||||
if (sink_muted) {
|
||||
res.emplace_back(port + "-muted");
|
||||
}
|
||||
res.push_back(port);
|
||||
return res;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sink_muted) {
|
||||
res.emplace_back("default-muted");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue