From 024f88322c1e1d2bbf07ec632f4e62fed32135b5 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Mon, 26 Jan 2026 12:39:17 +0200 Subject: [PATCH] wpctl: Allow virtual nodes in set-default command Use prefix matching instead of exact matching for media.class when validating nodes in the set-default command. This allows virtual nodes (e.g. Audio/Source/Virtual) to be set as default devices, while still excluding internal nodes. Fixes #896 Co-Authored-By: Claude Opus 4.5 --- src/tools/wpctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/wpctl.c b/src/tools/wpctl.c index 1c59d2ab..e059a532 100644 --- a/src/tools/wpctl.c +++ b/src/tools/wpctl.c @@ -870,7 +870,8 @@ set_default_run (WpCtl * self) media_class = wp_pipewire_object_get_property (WP_PIPEWIRE_OBJECT (proxy), PW_KEY_MEDIA_CLASS); for (guint i = 0; i < G_N_ELEMENTS (DEFAULT_NODE_MEDIA_CLASSES); i++) { - if (!g_strcmp0 (media_class, DEFAULT_NODE_MEDIA_CLASSES[i])) { + if (g_str_has_prefix (media_class, DEFAULT_NODE_MEDIA_CLASSES[i]) && + !g_str_has_suffix (media_class, "/Internal")) { gboolean res = FALSE; const gchar *name = wp_pipewire_object_get_property ( WP_PIPEWIRE_OBJECT (proxy), PW_KEY_NODE_NAME);