From d9034ede8efafc6334f7b2c56b6b3d299c2937fa Mon Sep 17 00:00:00 2001 From: ATMDA Date: Sun, 16 Nov 2025 13:26:11 -0500 Subject: controlcenter: lazyloading applicatoins in launcher pane --- modules/controlcenter/launcher/LauncherPane.qml | 108 +++++++++++++----------- 1 file changed, 61 insertions(+), 47 deletions(-) (limited to 'modules/controlcenter/launcher') diff --git a/modules/controlcenter/launcher/LauncherPane.qml b/modules/controlcenter/launcher/LauncherPane.qml index 0cb223b..71d1d6f 100644 --- a/modules/controlcenter/launcher/LauncherPane.qml +++ b/modules/controlcenter/launcher/LauncherPane.qml @@ -300,73 +300,87 @@ RowLayout { } } - StyledListView { - id: appsListView + Loader { + id: appsListLoader Layout.fillWidth: true Layout.fillHeight: true + asynchronous: true + active: { + // Lazy load: activate when left pane is loaded + // The ListView will load asynchronously, and search will work because filteredApps + // is updated regardless of whether the ListView is loaded + return leftLauncherLoader.item !== null; + } - model: root.filteredApps - spacing: Appearance.spacing.small / 2 - clip: true + sourceComponent: StyledListView { + id: appsListView + + Layout.fillWidth: true + Layout.fillHeight: true - StyledScrollBar.vertical: StyledScrollBar { - flickable: parent - } + model: root.filteredApps + spacing: Appearance.spacing.small / 2 + clip: true - delegate: StyledRect { - required property var modelData + StyledScrollBar.vertical: StyledScrollBar { + flickable: parent + } - width: parent ? parent.width : 0 + delegate: StyledRect { + required property var modelData - readonly property bool isSelected: root.selectedApp === modelData + width: parent ? parent.width : 0 - color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" - radius: Appearance.rounding.normal + readonly property bool isSelected: root.selectedApp === modelData - opacity: 0 + color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" + radius: Appearance.rounding.normal - Behavior on opacity { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutCubic - } - } + opacity: 0 - Component.onCompleted: { - opacity = 1; - } + Behavior on opacity { + NumberAnimation { + duration: 1000 + easing.type: Easing.OutCubic + } + } - StateLayer { - function onClicked(): void { - root.selectedApp = modelData; + Component.onCompleted: { + opacity = 1; } - } - RowLayout { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal + StateLayer { + function onClicked(): void { + root.selectedApp = modelData; + } + } - spacing: Appearance.spacing.normal + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: Appearance.padding.normal + + spacing: Appearance.spacing.normal + + IconImage { + Layout.alignment: Qt.AlignVCenter + implicitSize: 32 + source: { + const entry = modelData.entry; + return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; + } + } - IconImage { - Layout.alignment: Qt.AlignVCenter - implicitSize: 32 - source: { - const entry = modelData.entry; - return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; + StyledText { + Layout.fillWidth: true + text: modelData.name || modelData.entry?.name || qsTr("Unknown") + font.pointSize: Appearance.font.size.normal } } - StyledText { - Layout.fillWidth: true - text: modelData.name || modelData.entry?.name || qsTr("Unknown") - font.pointSize: Appearance.font.size.normal - } + implicitHeight: 40 } - - implicitHeight: 40 } } } -- cgit v1.2.3-freya