From c60475b293d02a61569df8f348dba6fd92f9006c Mon Sep 17 00:00:00 2001 From: Julian Bouzas Date: Thu, 27 Jun 2024 10:01:22 -0400 Subject: [PATCH] wpctl: Make sure default node Id is updated when printing filters This will properly show '*' for default sink filters in the status output. --- src/tools/wpctl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tools/wpctl.c b/src/tools/wpctl.c index d06f605b..9f507eca 100644 --- a/src/tools/wpctl.c +++ b/src/tools/wpctl.c @@ -299,6 +299,7 @@ static void print_filter_node (const GValue *item, gpointer data) { struct print_context *context = data; + g_autoptr (WpPlugin) def_nodes_api = NULL; WpPipewireObject *obj = g_value_get_object (item); g_autoptr (WpIterator) it = NULL; g_auto (GValue) val = G_VALUE_INIT; @@ -309,6 +310,8 @@ print_filter_node (const GValue *item, gpointer data) if (g_hash_table_contains (context->printed_filters, link_group)) return; + def_nodes_api = wp_plugin_find (context->self->core, "default-nodes-api"); + /* Print all nodes for this link_group */ printf (TREE_INDENT_LINE " - %-60s\n", link_group); it = wp_object_manager_new_filtered_iterator (context->self->om, @@ -329,6 +332,11 @@ print_filter_node (const GValue *item, gpointer data) name = wp_pipewire_object_get_property (node, PW_KEY_NODE_DESCRIPTION); media_class = wp_pipewire_object_get_property (node, PW_KEY_MEDIA_CLASS); + context->default_node = -1; + if (def_nodes_api) + g_signal_emit_by_name (def_nodes_api, "get-default-node", media_class, + &context->default_node); + printf (TREE_INDENT_LINE "%c %4u. %-60s [%s]\n", context->default_node == id ? '*' : ' ', id, name, media_class); }