diff --git a/Config/Config.qml b/Config/Config.qml index 9dfb7b8..76b67e0 100644 --- a/Config/Config.qml +++ b/Config/Config.qml @@ -10,6 +10,7 @@ Singleton { property alias accentColor: adapter.accentColor property alias wallpaperPath: adapter.wallpaperPath property alias maxWallpapers: adapter.maxWallpapers + property alias wallust: adapter.wallust FileView { id: root @@ -29,6 +30,7 @@ Singleton { property string baseBgColor: "#801a1a1a" property AccentColor accentColor: AccentColor {} property int maxWallpapers: 7 + property bool wallust: false } } } diff --git a/Modules/CustomTextField.qml b/Modules/CustomTextField.qml index f45fe37..55de91d 100644 --- a/Modules/CustomTextField.qml +++ b/Modules/CustomTextField.qml @@ -2,6 +2,7 @@ import Quickshell import QtQuick import QtQuick.Controls import qs.Helpers +import qs.Config TextField { id: root @@ -83,6 +84,9 @@ TextField { launcherWindow.visible = false; } else if ( wallpaperPickerLoader.active ) { WallpaperPath.currentWallpaperPath = wallpaperPickerLoader.item.currentItem.modelData.path; + if ( Config.wallust ) { + Wallust.generateColors(WallpaperPath.currentWallpaperPath); + } } event.accepted = true; } else if ( event.key === Qt.Key_Escape ) { diff --git a/Modules/Launcher.qml b/Modules/Launcher.qml index 1ab1212..aa3dba0 100644 --- a/Modules/Launcher.qml +++ b/Modules/Launcher.qml @@ -259,20 +259,19 @@ Scope { return 0; // Screen width - 4x outer rounding - 2x max side thickness (cause centered) - const barMargins = 10; - let outerMargins = 0; - const maxWidth = screen.width - (barMargins + outerMargins) * 2; + const margins = 10; + const maxWidth = screen.width - margins * 2; - if (maxWidth <= 0) + if ( maxWidth <= 0 ) return 0; - const maxItemsOnScreen = Math.floor(maxWidth / itemWidth); - const visible = Math.min(maxItemsOnScreen, Config.maxWallpapers, wallpaperModel.values.length); + const maxItemsOnScreen = Math.floor( maxWidth / itemWidth ); + const visible = Math.min( maxItemsOnScreen, Config.maxWallpapers, wallpaperModel.values.length ); - if (visible === 2) + if ( visible === 2 ) return 1; - if (visible > 1 && visible % 2 === 0) + if ( visible > 1 && visible % 2 === 0 ) return visible - 1; return visible; } diff --git a/Modules/Wallust.qml b/Modules/Wallust.qml new file mode 100644 index 0000000..15541ff --- /dev/null +++ b/Modules/Wallust.qml @@ -0,0 +1,22 @@ +pragma Singleton + +import Quickshell +import Quickshell.Io +import QtQuick + +Singleton { + id: root + + property var args + + function generateColors(wallpaperPath) { + root.args = wallpaperPath; + wallustProc.running = true; + } + + Process { + id: wallustProc + command: ["wallust", "run", root.args, "--palette=dark16", "--ignore-sequence=cursor", "--threshold=9" ] + running: false + } +} diff --git a/Wallpaper.qml b/Wallpaper.qml index be55ed4..415fc03 100644 --- a/Wallpaper.qml +++ b/Wallpaper.qml @@ -2,6 +2,7 @@ import Quickshell import QtQuick import Quickshell.Wayland import qs.Helpers +import qs.Modules Scope { Variants { @@ -24,6 +25,13 @@ Scope { anchors.fill: parent source: WallpaperPath.currentWallpaperPath fillMode: Image.PreserveAspectCrop + + // Behavior on source { + // Anim { + // properties: "opacity" + // duration: 500 + // } + // } } } }