I've noticed this with a few applications, e.g. KeePassXC and VLC from Flathub. Even though the application doesn't play any sound, there's a speaker icon in the task bar entry. This doesn't happen with the VLC version in Fedora's rpm repos.
When this happens, please provide the output of pacmd list-sink-inputs
I had Keepass and VLC running, and after I started playing an mp3 in VLC, an speaker icon appeared in both of their task bar entries: 1 sink input(s) available. index: 292 driver: <protocol-native.c> flags: START_CORKED FIX_RATE state: RUNNING sink: 0 <alsa_output.pci-0000_00_1b.0.analog-stereo> volume: front-left: 65536 / 100% / 0,00 dB, front-right: 65536 / 100% / 0,00 dB balance 0,00 muted: no current latency: 417,96 ms requested latency: 40,00 ms sample spec: float32le 2ch 48000Hz channel map: front-left,front-right Stereo resample method: copy module: 11 client: 163 <VLC media player (LibVLC 3.0.1)> properties: media.role = "video" media.name = "audio stream" application.name = "VLC media player (LibVLC 3.0.1)" native-protocol.peer = "UNIX socket client" native-protocol.version = "32" application.id = "org.VideoLAN.VLC" application.version = "3.0.1" application.icon_name = "vlc" application.language = "de_DE.UTF-8" application.process.id = "2" application.process.user = "awilms" application.process.host = "Samsung-Laptop" application.process.binary = "vlc" window.x11.display = ":99.0" application.process.machine_id = "Samsung-Laptop" application.process.session_id = "2" module-stream-restore.id = "sink-input-by-media-role:video"
state: RUNNING ← it should be state: CORKED when nothing is playing. You got the icon on both applications even though only VLC owns an audio stream? In addition to the state being wrong this could be an issue with mapping the application to its desktop file since it's sandboxed/a flatpak. What happens when you chose "New Instance" in either of the context menus?
Also, pressing pause/play makes the icon dis-/reappear. Could this maybe related to the fact that both applications are executed by running `flatpak run ...`?
Possible. Can you provide the xprop output of both VLC and keepass windows and their .desktop files?
I was playing auddio while running `pacmd list-sink-inputs`. I cannot start a new instance for VLC, but I can for Keepass. Afterwards, both task bar entries of Keepass show the audio icon.
Didn't you say you got an audio icon when the application did *not* play any sound? I'll see if I can install those from flathub and reproduce myself.
Created attachment 111671 [details] xprop output for Keepass
Created attachment 111672 [details] xprop output for VLC
Yes, I meant that Keepass had this icon, even though it didn't play any sound.
Created attachment 111673 [details] Keepass desktop file
Created attachment 111674 [details] VLC desktop file
The problem is indeed the flatpak runtime. The PID reported to PulseAudio for VLC player is "2" (kthreadd) and the WM_PID on Keepass is also 2, so it cannot tell. Not sure how/if this could be fixed on our side.
Should I file a bug report against flatpak?
That would be great! Let's see what they have to say.
Done: https://github.com/flatpak/flatpak/issues/1523
Let's close this for now until we have a word from them.
There've been two comments on the Flatpak bug report by Flatpak developers, mentioning that NET_WM_PID is not useful for differentiating between containerized applications and that GTK doesn't even set NET_WM_PID when run in a sandbox any more. Is there another, better way to differentiate between applications?
Currently no. I think we need to ask the Flatpak devs what their plans are.
Matthias Clasen told me that asking pulseaudio would be the best option and someone else commented that Unity8 queried pulseaudio with the application ID. Though I assume in that case, two VLC windows would still have the same indicator, even though only one might be playing a sound.