pulseaudio: Add 'sink-mapping' config option

This commit adds a new optional config to the pulseaudio modules. It
maps sink names to other sink names so that if the current sink is a
key, the sink named by the value is considered to be the current sink
instead of it.

E.g.
  "sink-mapping": {
    "easyeffects_sink": "speakers_sink"
  }
This commit is contained in:
Lauri Niskanen
2024-08-25 08:35:00 +03:00
parent 26329b660a
commit f1acea521b
5 changed files with 27 additions and 2 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ PulseaudioSlider::PulseaudioSlider(const std::string& id, const Json::Value& con
: ASlider(config, "pulseaudio-slider", id) {
backend = util::AudioBackend::getInstance([this] { this->dp.emit(); });
backend->setIgnoredSinks(config_["ignored-sinks"]);
backend->setSinkMapping(config_["sink-mapping"]);
if (config_["target"].isString()) {
std::string target = config_["target"].asString();
@@ -79,4 +80,4 @@ void PulseaudioSlider::onValueChanged() {
backend->changeVolume(volume, min_, max_);
}
} // namespace waybar::modules
} // namespace waybar::modules