mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Merge pull request #429 from tufteddeer/#420_mute_bt
add support for muted bluetooth audio, fix #420
This commit is contained in:
commit
9d0842db48
@ -116,6 +116,7 @@
|
|||||||
// "scroll-step": 1, // %, can be a float
|
// "scroll-step": 1, // %, can be a float
|
||||||
"format": "{volume}% {icon} {format_source}",
|
"format": "{volume}% {icon} {format_source}",
|
||||||
"format-bluetooth": "{volume}% {icon} {format_source}",
|
"format-bluetooth": "{volume}% {icon} {format_source}",
|
||||||
|
"format-bluetooth-muted": " {icon} {format_source}",
|
||||||
"format-muted": " {format_source}",
|
"format-muted": " {format_source}",
|
||||||
"format-source": "{volume}% ",
|
"format-source": "{volume}% ",
|
||||||
"format-source-muted": "",
|
"format-source-muted": "",
|
||||||
|
@ -197,19 +197,21 @@ const std::string waybar::modules::Pulseaudio::getPortIcon() const {
|
|||||||
|
|
||||||
auto waybar::modules::Pulseaudio::update() -> void {
|
auto waybar::modules::Pulseaudio::update() -> void {
|
||||||
auto format = format_;
|
auto format = format_;
|
||||||
if (muted_) {
|
std::string format_name = "format";
|
||||||
format = config_["format-muted"].isString() ? config_["format-muted"].asString() : format;
|
|
||||||
label_.get_style_context()->add_class("muted");
|
|
||||||
} else {
|
|
||||||
label_.get_style_context()->remove_class("muted");
|
|
||||||
if (monitor_.find("a2dp_sink") != std::string::npos) {
|
if (monitor_.find("a2dp_sink") != std::string::npos) {
|
||||||
format =
|
format_name = format_name + "-bluetooth";
|
||||||
config_["format-bluetooth"].isString() ? config_["format-bluetooth"].asString() : format;
|
|
||||||
label_.get_style_context()->add_class("bluetooth");
|
label_.get_style_context()->add_class("bluetooth");
|
||||||
} else {
|
} else {
|
||||||
label_.get_style_context()->remove_class("bluetooth");
|
label_.get_style_context()->remove_class("bluetooth");
|
||||||
}
|
}
|
||||||
|
if (muted_ ) {
|
||||||
|
format_name = format_name + "-muted";
|
||||||
|
label_.get_style_context()->add_class("muted");
|
||||||
|
} else {
|
||||||
|
label_.get_style_context()->remove_class("muted");
|
||||||
}
|
}
|
||||||
|
format =
|
||||||
|
config_[format_name].isString() ? config_[format_name].asString() : format;
|
||||||
// TODO: find a better way to split source/sink
|
// TODO: find a better way to split source/sink
|
||||||
std::string format_source = "{volume}%";
|
std::string format_source = "{volume}%";
|
||||||
if (source_muted_ && config_["format-source-muted"].isString()) {
|
if (source_muted_ && config_["format-source-muted"].isString()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user