forked from Shinonome/dots-hyprland
put wallpaper picker in loader and make it use real thumbnails
This commit is contained in:
@@ -11,6 +11,7 @@ Singleton {
|
||||
readonly property string config: StandardPaths.standardLocations(StandardPaths.ConfigLocation)[0]
|
||||
readonly property string state: StandardPaths.standardLocations(StandardPaths.StateLocation)[0]
|
||||
readonly property string cache: StandardPaths.standardLocations(StandardPaths.CacheLocation)[0]
|
||||
readonly property string genericCache: StandardPaths.standardLocations(StandardPaths.GenericCacheLocation)[0]
|
||||
readonly property string pictures: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
|
||||
readonly property string downloads: StandardPaths.standardLocations(StandardPaths.DownloadLocation)[0]
|
||||
|
||||
|
||||
@@ -14,11 +14,12 @@ import Quickshell.Hyprland
|
||||
Scope {
|
||||
id: scope
|
||||
|
||||
PanelWindow {
|
||||
Loader {
|
||||
active: GlobalStates.wallpaperOverviewOpen
|
||||
sourceComponent: PanelWindow {
|
||||
id: root
|
||||
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(root.screen)
|
||||
property bool monitorIsFocused: (Hyprland.focusedMonitor?.id == monitor?.id)
|
||||
visible: GlobalStates.wallpaperOverviewOpen
|
||||
property var filteredWallpapers: Wallpapers.wallpapers
|
||||
|
||||
WlrLayershell.namespace: "quickshell:wallpaper-overview"
|
||||
@@ -194,10 +195,10 @@ Scope {
|
||||
readonly property int rows: Math.max(1, Math.ceil(count / columns))
|
||||
|
||||
Layout.preferredWidth: columns * cellWidth
|
||||
Layout.alignment: Qt.AlignHcenter
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.fillHeight: true
|
||||
cellWidth: 220
|
||||
cellHeight: 140
|
||||
cellWidth: 128
|
||||
cellHeight: 72
|
||||
clip: true
|
||||
interactive: true
|
||||
keyNavigationWraps: true
|
||||
@@ -290,10 +291,16 @@ Scope {
|
||||
Image {
|
||||
id: thumbnailImage
|
||||
anchors.fill: parent
|
||||
source: `file://${modelData}`
|
||||
source: {
|
||||
const resolvedUrl = Qt.resolvedUrl(modelData);
|
||||
const md5Hash = Qt.md5(resolvedUrl);
|
||||
const cacheSize = "normal"
|
||||
const thumbnailPath = `${Directories.genericCache}/thumbnails/${cacheSize}/${md5Hash}.png`;
|
||||
return thumbnailPath
|
||||
}
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
asynchronous: true
|
||||
cache: false
|
||||
cache: true
|
||||
smooth: true
|
||||
|
||||
sourceSize.width: Math.min(128, grid.cellWidth - 16)
|
||||
@@ -392,6 +399,7 @@ Scope {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
name: "wallpaperOverviewToggle"
|
||||
|
||||
Reference in New Issue
Block a user