summaryrefslogtreecommitdiff
path: root/modules/launcher
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-19 23:48:06 +0800
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-19 23:48:06 +0800
commit3b31c2e1c8c1c9a17f7d37c469f6f0cf42a95725 (patch)
tree138c2308ec7a2e012e9f72797bfaeea9a3304264 /modules/launcher
parentfeat: close launcher and session on click out (diff)
downloadcaelestia-shell-3b31c2e1c8c1c9a17f7d37c469f6f0cf42a95725.tar.gz
caelestia-shell-3b31c2e1c8c1c9a17f7d37c469f6f0cf42a95725.tar.bz2
caelestia-shell-3b31c2e1c8c1c9a17f7d37c469f6f0cf42a95725.zip
launcher: limit wallpapers to screen width
Diffstat (limited to 'modules/launcher')
-rw-r--r--modules/launcher/WallpaperList.qml16
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/launcher/WallpaperList.qml b/modules/launcher/WallpaperList.qml
index 9a7c552..8c3afb2 100644
--- a/modules/launcher/WallpaperList.qml
+++ b/modules/launcher/WallpaperList.qml
@@ -10,6 +10,18 @@ PathView {
required property TextField search
required property PersistentProperties visibilities
+ readonly property int numItems: {
+ const screenWidth = QsWindow.window?.screen.width - BorderConfig.thickness * 2 - BorderConfig.rounding * 4 - Appearance.padding.large * 2;
+ if (!screenWidth)
+ return 0;
+ const itemWidth = LauncherConfig.sizes.wallpaperWidth * 0.8;
+ const max = LauncherConfig.maxWallpapers;
+ if (max * itemWidth > screenWidth) {
+ const items = Math.floor(screenWidth / itemWidth);
+ return items > 1 && items % 2 === 0 ? items - 1 : items;
+ }
+ return max;
+ }
model: ScriptModel {
readonly property string search: root.search.text.split(" ").slice(1).join(" ")
@@ -31,8 +43,8 @@ PathView {
Wallpapers.preview(currentItem.modelData.path);
}
- implicitWidth: Math.min(LauncherConfig.maxWallpapers, count) * (LauncherConfig.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
- pathItemCount: LauncherConfig.maxWallpapers
+ implicitWidth: Math.min(numItems, count) * (LauncherConfig.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
+ pathItemCount: numItems
cacheItemCount: 4
snapMode: PathView.SnapToItem