summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorATMDA <atdma2600@gmail.com>2025-11-16 13:21:59 -0500
committerATMDA <atdma2600@gmail.com>2025-11-16 14:03:20 -0500
commitf77323b136a3773266a1140a17e5f7b4cb3f26e7 (patch)
tree5167f8cf63b10231d4e2931b823e60c1c1f1c47e /modules
parentcontrolcenter: delay heavy operations until animation completes (diff)
downloadcaelestia-shell-f77323b136a3773266a1140a17e5f7b4cb3f26e7.tar.gz
caelestia-shell-f77323b136a3773266a1140a17e5f7b4cb3f26e7.tar.bz2
caelestia-shell-f77323b136a3773266a1140a17e5f7b4cb3f26e7.zip
controlcenter: lazyloading wallpaper
Diffstat (limited to 'modules')
-rw-r--r--modules/controlcenter/appearance/AppearancePane.qml65
1 files changed, 40 insertions, 25 deletions
diff --git a/modules/controlcenter/appearance/AppearancePane.qml b/modules/controlcenter/appearance/AppearancePane.qml
index 09cb04f..fb67ec3 100644
--- a/modules/controlcenter/appearance/AppearancePane.qml
+++ b/modules/controlcenter/appearance/AppearancePane.qml
@@ -1895,34 +1895,47 @@ RowLayout {
Item {
Layout.fillWidth: true
Layout.topMargin: Appearance.spacing.large
- Layout.preferredHeight: wallpaperGrid.Layout.preferredHeight
+ Layout.preferredHeight: wallpaperLoader.item ? wallpaperLoader.item.layoutPreferredHeight : 0
- GridView {
- id: wallpaperGrid
+ Loader {
+ id: wallpaperLoader
anchors.fill: parent
-
- readonly property int minCellWidth: 200 + Appearance.spacing.normal
- readonly property int columnsCount: Math.max(1, Math.floor(parent.width / minCellWidth))
-
- Layout.preferredHeight: Math.ceil(count / columnsCount) * cellHeight
- height: Layout.preferredHeight
-
- // Distribute width evenly across columns
- cellWidth: width / columnsCount
- cellHeight: 140 + Appearance.spacing.normal
-
- leftMargin: 0
- rightMargin: 0
- topMargin: 0
- bottomMargin: 0
+ asynchronous: true
+ active: {
+ // Lazy load: only activate when right pane is loaded
+ // This defers heavy wallpaper list loading until the right pane is visible
+ return rightAppearanceLoader.item !== null;
+ }
+
+ sourceComponent: Item {
+ property alias layoutPreferredHeight: wallpaperGrid.layoutPreferredHeight
+
+ GridView {
+ id: wallpaperGrid
+ anchors.fill: parent
+
+ readonly property int minCellWidth: 200 + Appearance.spacing.normal
+ readonly property int columnsCount: Math.max(1, Math.floor(parent.width / minCellWidth))
+
+ readonly property int layoutPreferredHeight: Math.ceil(count / columnsCount) * cellHeight
+ height: layoutPreferredHeight
+
+ // Distribute width evenly across columns
+ cellWidth: width / columnsCount
+ cellHeight: 140 + Appearance.spacing.normal
+
+ leftMargin: 0
+ rightMargin: 0
+ topMargin: 0
+ bottomMargin: 0
- model: Wallpapers.list
-
- // Disable GridView's own scrolling - let parent handle it
- interactive: false
+ model: Wallpapers.list
+
+ // Disable GridView's own scrolling - let parent handle it
+ interactive: false
- // Enable caching for better performance
- cacheBuffer: cellHeight * 2
+ // Enable caching for better performance
+ cacheBuffer: cellHeight * 2
delegate: Item {
required property var modelData
@@ -2141,7 +2154,9 @@ RowLayout {
}
}
}
- }
+ }
+ }
+ }
}
}
}