diff --git a/components/mobileshell/qml/taskswitcher/Task.qml b/components/mobileshell/qml/taskswitcher/Task.qml index 366e6f92..f9c67b97 100644 --- a/components/mobileshell/qml/taskswitcher/Task.qml +++ b/components/mobileshell/qml/taskswitcher/Task.qml @@ -221,15 +221,20 @@ Item { // app icon (behind window preview in-case it doesn't load) TaskIcon { // decrease the opacity faster - opacity: delegate.opacity + opacity: pipeWireLoader.item && pipeWireLoader.item.uuid ? 0 : delegate.opacity anchors.centerIn: parent } // attempt to load window preview Loader { id: pipeWireLoader + active: taskSwitcher.visible || taskSwitcher.tasksModel.taskReorderingEnabled anchors.fill: parent source: Qt.resolvedUrl("./Thumbnail.qml") + + asynchronous: true + + onLoaded: this.item.refresh() } // darken effect diff --git a/components/mobileshell/qml/taskswitcher/Thumbnail.qml b/components/mobileshell/qml/taskswitcher/Thumbnail.qml index 9adcb183..1330e549 100644 --- a/components/mobileshell/qml/taskswitcher/Thumbnail.qml +++ b/components/mobileshell/qml/taskswitcher/Thumbnail.qml @@ -11,19 +11,25 @@ import QtQuick.Window 2.2 import org.kde.taskmanager 0.1 as TaskManager TaskManager.PipeWireSourceItem { - visible: Window.visibility !== Window.Hidden + visible: false nodeId: waylandItem.nodeId + + // Visible only if casting has begun + onNodeIdChanged: { + visible = true; + } + + readonly property string uuid: waylandItem.uuid - onVisibleChanged: { - if (visible) { - if (model.WinIdList) { - waylandItem.uuid = model.WinIdList[0]; - } + function refresh() { + if (model.WinIdList) { + waylandItem.uuid = model.WinIdList[0]; } } TaskManager.ScreencastingRequest { id: waylandItem + uuid: "" } }