From 8261fc6a9c1d8553a947377ccdcc9acd732aa2ab Mon Sep 17 00:00:00 2001 From: flodavid Date: Sun, 8 Feb 2026 00:27:12 +0100 Subject: [PATCH] Fix empty "Applications" tab - Fixes #290 - Was introducted by #280 - Skipped application when PROP_APPLICATION_ID was absent, which never seems to be set - Skipped application when PROP_APPLICATION_NAME was absent. It was because from_sink_input_info() previously did not handle it - Add "Bluetooth Device", "Device" or "Unknown" entry depending on input properties --- src/App.vala | 23 +++++++++++++++++++++-- src/PulseAudioManager.vala | 8 -------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/App.vala b/src/App.vala index 645917ef..647be9b1 100644 --- a/src/App.vala +++ b/src/App.vala @@ -28,7 +28,22 @@ public class Sound.App : Object { public App.from_sink_input_info (PulseAudio.SinkInputInfo sink_input) { index = sink_input.index; - name = sink_input.proplist.gets (PulseAudio.Proplist.PROP_APPLICATION_NAME); + + if (sink_input.proplist.contains (PulseAudio.Proplist.PROP_APPLICATION_NAME) == 1) { + name = sink_input.proplist.gets (PulseAudio.Proplist.PROP_APPLICATION_NAME); + } else { + if (sink_input.proplist.contains (PulseAudio.Proplist.PROP_DEVICE_API) == 1 && + sink_input.proplist.gets (PulseAudio.Proplist.PROP_DEVICE_API) == "bluez5" + ) { + name = _("Bluetooth Device"); + } else { + if (sink_input.proplist.contains (PulseAudio.Proplist.PROP_DEVICE_PRODUCT_ID) == 1) { + name = _("Device"); + } else { + name = _("Unknown"); + } + } + } string app_id; if (sink_input.proplist.contains (PulseAudio.Proplist.PROP_APPLICATION_ID) == 1) { @@ -52,7 +67,11 @@ public class Sound.App : Object { if (sink_input.proplist.contains (PulseAudio.Proplist.PROP_APPLICATION_ICON_NAME) == 1) { icon = new ThemedIcon (sink_input.proplist.gets (PulseAudio.Proplist.PROP_APPLICATION_ICON_NAME)); } else { - icon = new ThemedIcon ("application-default-icon"); + if (sink_input.proplist.contains (PulseAudio.Proplist.PROP_DEVICE_ICON_NAME) == 1) { + icon = new ThemedIcon (sink_input.proplist.gets (PulseAudio.Proplist.PROP_DEVICE_ICON_NAME)); + } else { + icon = new ThemedIcon ("application-default-icon"); + } } } } diff --git a/src/PulseAudioManager.vala b/src/PulseAudioManager.vala index c73bc224..7d5d9733 100644 --- a/src/PulseAudioManager.vala +++ b/src/PulseAudioManager.vala @@ -610,14 +610,6 @@ public class Sound.PulseAudioManager : GLib.Object { return; } - // Can't construct an app object - if ( - sink_input.proplist.contains (PulseAudio.Proplist.PROP_APPLICATION_ID) == 0 || - sink_input.proplist.contains (PulseAudio.Proplist.PROP_APPLICATION_NAME) == 0 - ) { - return; - } - App? app = null; for (uint i = 0; i < apps.get_n_items (); i++) { var _app = (App) apps.get_item (i);