Merge pull request #309 from dlasky/btaudio

fix(btformat): fixes an issue where btformat was not detected
This commit is contained in:
Alex 2019-05-12 12:12:16 +02:00 committed by GitHub
commit 10a17187a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -33,6 +33,7 @@ class Pulseaudio : public ALabel {
bool muted_; bool muted_;
std::string port_name_; std::string port_name_;
std::string desc_; std::string desc_;
std::string monitor_;
bool scrolling_; bool scrolling_;
}; };

View File

@ -148,6 +148,7 @@ void waybar::modules::Pulseaudio::sinkInfoCb(pa_context * /*context*/, const pa_
pa->volume_ = std::round(volume * 100.0F); pa->volume_ = std::round(volume * 100.0F);
pa->muted_ = i->mute != 0; pa->muted_ = i->mute != 0;
pa->desc_ = i->description; pa->desc_ = i->description;
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";
pa->dp.emit(); pa->dp.emit();
} }
@ -192,7 +193,7 @@ auto waybar::modules::Pulseaudio::update() -> void {
label_.get_style_context()->add_class("muted"); label_.get_style_context()->add_class("muted");
} else { } else {
label_.get_style_context()->remove_class("muted"); label_.get_style_context()->remove_class("muted");
if (port_name_.find("a2dp_sink") != std::string::npos) { if (monitor_.find("a2dp_sink") != std::string::npos) {
format = format =
config_["format-bluetooth"].isString() ? config_["format-bluetooth"].asString() : format; config_["format-bluetooth"].isString() ? config_["format-bluetooth"].asString() : format;
label_.get_style_context()->add_class("bluetooth"); label_.get_style_context()->add_class("bluetooth");