summaryrefslogtreecommitdiff
path: root/modules/launcher
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-23 16:08:02 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-08-23 16:08:02 +1000
commit66c0d0a15fd9e7ab3c42c3e0f30ead8d793b8352 (patch)
tree93d40383a04dcff5b5b62103a944c1126fc9725c /modules/launcher
parentdashboard: better visualiser (diff)
downloadcaelestia-shell-66c0d0a15fd9e7ab3c42c3e0f30ead8d793b8352.tar.gz
caelestia-shell-66c0d0a15fd9e7ab3c42c3e0f30ead8d793b8352.tar.bz2
caelestia-shell-66c0d0a15fd9e7ab3c42c3e0f30ead8d793b8352.zip
launcher: exact calculation for wallpaper width
Fixes #322
Diffstat (limited to 'modules/launcher')
-rw-r--r--modules/launcher/Content.qml5
-rw-r--r--modules/launcher/ContentList.qml4
-rw-r--r--modules/launcher/WallpaperList.qml29
-rw-r--r--modules/launcher/Wrapper.qml3
4 files changed, 33 insertions, 8 deletions
diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml
index 9b0e4e5..a8d8422 100644
--- a/modules/launcher/Content.qml
+++ b/modules/launcher/Content.qml
@@ -11,7 +11,10 @@ import QtQuick
Item {
id: root
+ required property var wrapper
required property PersistentProperties visibilities
+ required property var panels
+
readonly property int padding: Appearance.padding.large
readonly property int rounding: Appearance.rounding.large
@@ -34,7 +37,9 @@ Item {
ContentList {
id: list
+ wrapper: root.wrapper
visibilities: root.visibilities
+ panels: root.panels
search: search
padding: root.padding
rounding: root.rounding
diff --git a/modules/launcher/ContentList.qml b/modules/launcher/ContentList.qml
index e363c7b..d426d58 100644
--- a/modules/launcher/ContentList.qml
+++ b/modules/launcher/ContentList.qml
@@ -11,7 +11,9 @@ import QtQuick.Controls
Item {
id: root
+ required property var wrapper
required property PersistentProperties visibilities
+ required property var panels
required property TextField search
required property int padding
required property int rounding
@@ -103,6 +105,8 @@ Item {
sourceComponent: WallpaperList {
search: root.search
visibilities: root.visibilities
+ panels: root.panels
+ wrapper: root.wrapper
}
}
diff --git a/modules/launcher/WallpaperList.qml b/modules/launcher/WallpaperList.qml
index 9c402ad..e66ae5c 100644
--- a/modules/launcher/WallpaperList.qml
+++ b/modules/launcher/WallpaperList.qml
@@ -12,18 +12,31 @@ PathView {
required property TextField search
required property PersistentProperties visibilities
+ required property var panels
+ required property var wrapper
+
+ readonly property int itemWidth: Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2
+
readonly property int numItems: {
- const screenWidth = QsWindow.window?.screen.width * 0.8;
- if (!screenWidth)
+ const screen = QsWindow.window?.screen;
+ if (!screen)
+ return 0;
+
+ // Screen width - 4x outer rounding - 2x max side thickness (cause centered)
+ let outerMargins = Math.max(Config.border.thickness, panels.bar.implicitWidth);
+ if (panels.popouts.hasCurrent && panels.popouts.currentCenter + panels.popouts.nonAnimHeight / 2 > screen.height - wrapper.implicitHeight - Config.border.thickness * 2)
+ outerMargins = panels.bar.implicitWidth + panels.popouts.nonAnimWidth;
+ const maxWidth = screen.width - Config.border.rounding * 4 - outerMargins * 2;
+
+ if (maxWidth <= 0)
return 0;
- const itemWidth = Config.launcher.sizes.wallpaperWidth * 0.8;
- const max = Config.launcher.maxWallpapers;
- const maxItemsOnScreen = Math.floor(screenWidth / itemWidth);
- const visible = Math.min(maxItemsOnScreen, max, scriptModel.values.length);
+ const maxItemsOnScreen = Math.floor(maxWidth / itemWidth);
+ const visible = Math.min(maxItemsOnScreen, Config.launcher.maxWallpapers, scriptModel.values.length);
+
if (visible === 2)
return 1;
- else if (visible > 1 && visible % 2 === 0)
+ if (visible > 1 && visible % 2 === 0)
return visible - 1;
return visible;
}
@@ -45,7 +58,7 @@ PathView {
Wallpapers.preview(currentItem.modelData.path);
}
- implicitWidth: Math.min(numItems, count) * (Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
+ implicitWidth: Math.min(numItems, count) * itemWidth
pathItemCount: numItems
cacheItemCount: 4
diff --git a/modules/launcher/Wrapper.qml b/modules/launcher/Wrapper.qml
index 41126dd..f1ab672 100644
--- a/modules/launcher/Wrapper.qml
+++ b/modules/launcher/Wrapper.qml
@@ -6,6 +6,7 @@ Item {
id: root
required property PersistentProperties visibilities
+ required property var panels
visible: height > 0
implicitHeight: 0
@@ -50,6 +51,8 @@ Item {
Content {
id: content
+ wrapper: root
visibilities: root.visibilities
+ panels: root.panels
}
}