controlcenter: lazyloading applicatoins in launcher pane

This commit is contained in:
ATMDA 2025-11-16 13:26:11 -05:00
parent f77323b136
commit d9034ede8e

View file

@ -300,73 +300,87 @@ RowLayout {
} }
} }
StyledListView { Loader {
id: appsListView id: appsListLoader
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
asynchronous: true
model: root.filteredApps active: {
spacing: Appearance.spacing.small / 2 // Lazy load: activate when left pane is loaded
clip: true // The ListView will load asynchronously, and search will work because filteredApps
// is updated regardless of whether the ListView is loaded
StyledScrollBar.vertical: StyledScrollBar { return leftLauncherLoader.item !== null;
flickable: parent
} }
delegate: StyledRect { sourceComponent: StyledListView {
required property var modelData id: appsListView
width: parent ? parent.width : 0 Layout.fillWidth: true
Layout.fillHeight: true
readonly property bool isSelected: root.selectedApp === modelData model: root.filteredApps
spacing: Appearance.spacing.small / 2
clip: true
color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" StyledScrollBar.vertical: StyledScrollBar {
radius: Appearance.rounding.normal flickable: parent
opacity: 0
Behavior on opacity {
NumberAnimation {
duration: 1000
easing.type: Easing.OutCubic
}
} }
Component.onCompleted: { delegate: StyledRect {
opacity = 1; required property var modelData
}
StateLayer { width: parent ? parent.width : 0
function onClicked(): void {
root.selectedApp = modelData;
}
}
RowLayout { readonly property bool isSelected: root.selectedApp === modelData
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Appearance.padding.normal
spacing: Appearance.spacing.normal color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent"
radius: Appearance.rounding.normal
IconImage { opacity: 0
Layout.alignment: Qt.AlignVCenter
implicitSize: 32 Behavior on opacity {
source: { NumberAnimation {
const entry = modelData.entry; duration: 1000
return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; easing.type: Easing.OutCubic
} }
} }
StyledText { Component.onCompleted: {
Layout.fillWidth: true opacity = 1;
text: modelData.name || modelData.entry?.name || qsTr("Unknown")
font.pointSize: Appearance.font.size.normal
} }
}
implicitHeight: 40 StateLayer {
function onClicked(): void {
root.selectedApp = modelData;
}
}
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";
}
}
StyledText {
Layout.fillWidth: true
text: modelData.name || modelData.entry?.name || qsTr("Unknown")
font.pointSize: Appearance.font.size.normal
}
}
implicitHeight: 40
}
} }
} }
} }