diff --git a/plasmoid/package/contents/ui/PulseAudio.qml b/plasmoid/package/contents/ui/PulseAudio.qml index b963dea57..914850ec2 100644 --- a/plasmoid/package/contents/ui/PulseAudio.qml +++ b/plasmoid/package/contents/ui/PulseAudio.qml @@ -45,8 +45,7 @@ QtObject { var streams = [] for (var i = 0, length = instantiator.count; i < length; ++i) { var stream = instantiator.objectAt(i); - if (stream[key] === value - || (key==="appName" && stream[key].toLowerCase() === value.toLowerCase())) { + if (stream[key] === value || (key==="appName" && stream[key].toLowerCase() === value.toLowerCase())) { streams.push(stream); } } @@ -58,7 +57,23 @@ QtObject { } function streamsForPid(pid) { - return findStreams("pid", pid); + var streams = findStreams("pid", pid); + + if (streams.length === 0) { + for (var i = 0, length = instantiator.count; i < length; ++i) { + var stream = instantiator.objectAt(i); + + if (stream.parentPid === -1) { + stream.parentPid = backend.parentPid(stream.pid); + } + + if (stream.parentPid === pid) { + streams.push(stream); + } + } + } + + return streams; } // QtObject has no default property, hence adding the Instantiator to one explicitly. @@ -70,10 +85,13 @@ QtObject { delegate: QtObject { readonly property int pid: Client ? Client.properties["application.process.id"] : 0 + // Determined on demand. + property int parentPid: -1 readonly property string appName: Client ? Client.properties["application.name"] : "" readonly property bool muted: Muted // whether there is nothing actually going on on that stream readonly property bool corked: Corked + readonly property int volume: Math.round(pulseVolume / PulseAudio.NormalVolume * 100.0) readonly property int pulseVolume: Volume diff --git a/plasmoid/package/contents/ui/task/TaskItem.qml b/plasmoid/package/contents/ui/task/TaskItem.qml index 0ea64b8b4..76a0ff580 100644 --- a/plasmoid/package/contents/ui/task/TaskItem.qml +++ b/plasmoid/package/contents/ui/task/TaskItem.qml @@ -721,13 +721,8 @@ AbilityItem.BasicItem { // a PID to an audio stream window. Otherwise if you have two instances of // an application, one playing and the other not, it will look up appName // for the non-playing instance and erroneously show an indicator on both. - if (!pa.hasPidMatch(taskItem.appName)) { - var streams_result; - streams_result = pa.streamsForAppName(taskItem.appName); - if (streams_result.length===0 && launcherName !== "") { - streams_result = pa.streamsForAppName(launcherName); - } - streams = streams_result; + if (!pa.hasPidMatch(task.appName)) { + streams = pa.streamsForAppName(task.appName); } }