From 18a2b90fc0cb027464c68f41819bf1c9a48a409e Mon Sep 17 00:00:00 2001 From: Denis Drakhnia Date: Tue, 11 Apr 2023 08:09:01 +0300 Subject: [PATCH 1/2] fix: generate wireplumber module man page --- man/waybar-wireplumber.5.scd | 2 +- meson.build | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/man/waybar-wireplumber.5.scd b/man/waybar-wireplumber.5.scd index 3cf5694d..60883774 100644 --- a/man/waybar-wireplumber.5.scd +++ b/man/waybar-wireplumber.5.scd @@ -15,7 +15,7 @@ The *wireplumber* module displays the current volume reported by WirePlumber. default: *{volume}%* ++ The format, how information should be displayed. This format is used when other formats aren't specified. - *format-muted*: ++ +*format-muted*: ++ typeof: string ++ This format is used when the sound is muted. diff --git a/meson.build b/meson.build index 58e1c672..f3b7c6e4 100644 --- a/meson.build +++ b/meson.build @@ -430,6 +430,7 @@ if scdoc.found() 'waybar-bluetooth.5.scd', 'waybar-sndio.5.scd', 'waybar-upower.5.scd', + 'waybar-wireplumber.5.scd', ] if (giounix.found() and not get_option('logind').disabled()) From 3b2dfeec010dd0165a30266796e3afc87df14b09 Mon Sep 17 00:00:00 2001 From: skylar779 <89084411+skylar779@users.noreply.github.com> Date: Tue, 11 Apr 2023 10:51:25 +0200 Subject: [PATCH 2/2] Made use of node_id_ Checking against names for volume changes seems a bit weird to me and also didn't really work, so I've made use of node_id_ to check against this instead and also fixed an issue, where the volume update would refuse to do its thing despite it being the same id that was used on launch. --- src/modules/wireplumber.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp index 7d9689c3..0c4848ac 100644 --- a/src/modules/wireplumber.cpp +++ b/src/modules/wireplumber.cpp @@ -120,11 +120,11 @@ void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber* const gchar* name = wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(node), "node.name"); - if (g_strcmp0(self->default_node_name_, name) != 0) { + if (self->node_id_ != id) { spdlog::debug( "[{}]: (onMixerChanged) - ignoring mixer update for node: id: {}, name: {} as it is not " - "the default node: {}", - self->name_, id, name, self->default_node_name_); + "the default node: {} with id: {}", + self->name_, id, name, self->default_node_name_, self->node_id_); return; } @@ -176,6 +176,7 @@ void waybar::modules::Wireplumber::onDefaultNodesApiChanged(waybar::modules::Wir g_free(self->default_node_name_); self->default_node_name_ = g_strdup(default_node_name); + self->node_id_ = default_node_id; updateVolume(self, default_node_id); updateNodeName(self, default_node_id); } @@ -197,18 +198,17 @@ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wir throw std::runtime_error("Mixer api is not loaded\n"); } - uint32_t default_node_id; g_signal_emit_by_name(self->def_nodes_api_, "get-default-configured-node-name", "Audio/Sink", &self->default_node_name_); - g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &default_node_id); + g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &self->node_id_); if (self->default_node_name_) { spdlog::debug("[{}]: (onObjectManagerInstalled) - default configured node name: {} and id: {}", - self->name_, self->default_node_name_, default_node_id); + self->name_, self->default_node_name_, self->node_id_); } - updateVolume(self, default_node_id); - updateNodeName(self, default_node_id); + updateVolume(self, self->node_id_); + updateNodeName(self, self->node_id_); g_signal_connect_swapped(self->mixer_api_, "changed", (GCallback)onMixerChanged, self); g_signal_connect_swapped(self->def_nodes_api_, "changed", (GCallback)onDefaultNodesApiChanged,