fix(audio): scope stream volume overrides per media identity

This commit is contained in:
Lysec
2026-03-27 13:12:06 +01:00
parent 0133da8bd0
commit 6b2c0fc9c4
3 changed files with 32 additions and 12 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ Item {
quickSwitchTimer.stop();
}
function dismissToast(){
function dismissToast() {
if (windowLoader.item) {
hideTimer.stop();
windowLoader.item.hideToast();
+29 -9
View File
@@ -307,7 +307,7 @@ Singleton {
objects: [...root.sinks, ...root.sources]
}
// Per-app volume persistence (survives stream recreation on track change/seek)
// Per-stream volume overrides (app + media identity) so concurrent browser streams do not share one entry.
property var appVolumeOverrides: ({})
property var _knownAppStreamIds: ({})
property bool _isApplyingAppOverride: false
@@ -360,21 +360,41 @@ Singleton {
return "";
}
var props = node.properties;
var base = "";
var binary = props["application.process.binary"] || "";
if (binary) {
var parts = binary.split("/");
return parts[parts.length - 1].toLowerCase();
base = parts[parts.length - 1].toLowerCase();
}
var appName = props["application.name"] || "";
if (appName) {
return appName.toLowerCase();
if (!base) {
var appName = props["application.name"] || "";
if (appName) {
base = appName.toLowerCase();
}
}
var appId = props["application.id"] || "";
if (appId) {
return appId.toLowerCase();
if (!base) {
var appId = props["application.id"] || "";
if (appId) {
base = appId.toLowerCase();
}
}
if (!base) {
return "";
}
return "";
var mediaName = (props["media.name"] || "").trim().toLowerCase();
var mediaRole = (props["media.role"] || "").trim().toLowerCase();
var tagParts = [];
if (mediaName) {
tagParts.push(mediaName);
}
if (mediaRole) {
tagParts.push(mediaRole);
}
if (tagParts.length > 0) {
return base + "\u001f" + tagParts.join("\u001e");
}
return base + "\u001f" + String(node.id);
}
function setAppStreamVolume(appKey: string, volume: real): void {
+2 -2
View File
@@ -10,7 +10,7 @@ Singleton {
// actionLabel: optional label for clickable action link
// actionCallback: optional function to call when action is clicked
signal notify(string title, string description, string icon, string type, int duration, string actionLabel, var actionCallback)
signal dismiss()
signal dismiss
// Convenience methods
function showNotice(title, description = "", icon = "", duration = 3000, actionLabel = "", actionCallback = null) {
@@ -25,7 +25,7 @@ Singleton {
notify(title, description, "", "error", duration, actionLabel, actionCallback);
}
function dismissToast(){
function dismissToast() {
dismiss();
}
}