taskswitcher: Improve performance of task preview loading

This commit is contained in:
Devin Lin 2022-12-08 21:24:33 -05:00
parent eafc2eca99
commit 1ae83644c8
2 changed files with 5 additions and 7 deletions

View file

@ -227,13 +227,10 @@ Item {
// attempt to load window preview // attempt to load window preview
Loader { Loader {
id: pipeWireLoader id: pipeWireLoader
active: (taskSwitcher.visible || taskSwitcher.tasksModel.taskReorderingEnabled) && MobileShell.MobileShellSettings.taskSwitcherPreviewsEnabled active: MobileShell.MobileShellSettings.taskSwitcherPreviewsEnabled
anchors.fill: parent anchors.fill: parent
source: Qt.resolvedUrl("./Thumbnail.qml") source: Qt.resolvedUrl("./Thumbnail.qml")
asynchronous: true asynchronous: true
onLoaded: this.item.refresh()
} }
// darken effect // darken effect

View file

@ -13,13 +13,14 @@ import org.kde.taskmanager 0.1 as TaskManager
PipeWire.PipeWireSourceItem { PipeWire.PipeWireSourceItem {
id: root id: root
visible: nodeId > 0 visible: (taskSwitcher.visible || taskSwitcher.tasksModel.taskReorderingEnabled)
opacity: (nodeId > 0) ? 1 : 0
nodeId: waylandItem.nodeId nodeId: waylandItem.nodeId
readonly property alias uuid: waylandItem.uuid readonly property alias uuid: waylandItem.uuid
function refresh() { onVisibleChanged: {
if (model.WinIdList) { if (model.WinIdList && visible) {
waylandItem.uuid = model.WinIdList[0]; waylandItem.uuid = model.WinIdList[0];
} }
} }