Merge pull request #550 from PlusMinus0/use_form_factor
Use PA_PROP_DEVICE_FORM_FACTOR for device icon.
This commit is contained in:
commit
d5875c468f
|
@ -34,6 +34,7 @@ class Pulseaudio : public ALabel {
|
||||||
pa_cvolume pa_volume_;
|
pa_cvolume pa_volume_;
|
||||||
bool muted_;
|
bool muted_;
|
||||||
std::string port_name_;
|
std::string port_name_;
|
||||||
|
std::string form_factor_;
|
||||||
std::string desc_;
|
std::string desc_;
|
||||||
std::string monitor_;
|
std::string monitor_;
|
||||||
// SOURCE
|
// SOURCE
|
||||||
|
|
|
@ -158,6 +158,9 @@ void waybar::modules::Pulseaudio::sinkInfoCb(pa_context * /*context*/, const pa_
|
||||||
pa->desc_ = i->description;
|
pa->desc_ = i->description;
|
||||||
pa->monitor_ = i->monitor_source_name;
|
pa->monitor_ = i->monitor_source_name;
|
||||||
pa->port_name_ = i->active_port != nullptr ? i->active_port->name : "Unknown";
|
pa->port_name_ = i->active_port != nullptr ? i->active_port->name : "Unknown";
|
||||||
|
if (auto ff = pa_proplist_gets(i->proplist, PA_PROP_DEVICE_FORM_FACTOR)) {
|
||||||
|
pa->form_factor_ = ff;
|
||||||
|
}
|
||||||
pa->dp.emit();
|
pa->dp.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +188,7 @@ static const std::array<std::string, 9> ports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string waybar::modules::Pulseaudio::getPortIcon() const {
|
const std::string waybar::modules::Pulseaudio::getPortIcon() const {
|
||||||
std::string nameLC = port_name_;
|
std::string nameLC = port_name_ + form_factor_;
|
||||||
std::transform(nameLC.begin(), nameLC.end(), nameLC.begin(), ::tolower);
|
std::transform(nameLC.begin(), nameLC.end(), nameLC.begin(), ::tolower);
|
||||||
for (auto const &port : ports) {
|
for (auto const &port : ports) {
|
||||||
if (nameLC.find(port) != std::string::npos) {
|
if (nameLC.find(port) != std::string::npos) {
|
||||||
|
|
Loading…
Reference in New Issue