diff --git a/modules/bar/widgets/Tray.qml b/modules/bar/widgets/Tray.qml index c306fad..7bfaf73 100644 --- a/modules/bar/widgets/Tray.qml +++ b/modules/bar/widgets/Tray.qml @@ -81,7 +81,7 @@ Row { // Workspace Row Image { // Image id: iconImage - source: modelData.icon + // source: modelData.icon; Does not work for some tray icons fillMode: Image.PreserveAspectCrop anchors.centerIn: parent @@ -89,6 +89,29 @@ Row { // Workspace Row width: bar.height*0.5 height: bar.height*0.5 + Component.onCompleted: { + // Default to the original icon + let src = modelData.icon; + + // Check if there is a "?" in the URL (custom path) + if (src.includes('?')) { + let pathMatch = src.match(/path=([^&]+)/); + if (pathMatch && pathMatch[1]) { + + let folderPath = pathMatch[1]; + // Build a file:// URL pointing to the actual icon file + let segments = folderPath.split('/'); + let fileName = segments[segments.length - 1] + "-icon.png"; + console.log("########## filename: " + fileName) + src = "file://" + pathMatch[1] + "/" + fileName; + } + } + + // Set the resolved source + iconImage.source = src; + + // console.log("Resolved icon source:", src); + } asynchronous: true cache: true }