diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-05 14:26:26 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-05 14:26:26 +1100 |
| commit | f23192156866093a1d4a7f0a5e75dc0b27d0fc5d (patch) | |
| tree | 5f5873e21db1cc9a9fc2e1e651853a1e229c89f3 /src/services/wallpapers.ts | |
| parent | wallpapers: filter by size (diff) | |
| download | caelestia-shell-f23192156866093a1d4a7f0a5e75dc0b27d0fc5d.tar.gz caelestia-shell-f23192156866093a1d4a7f0a5e75dc0b27d0fc5d.tar.bz2 caelestia-shell-f23192156866093a1d4a7f0a5e75dc0b27d0fc5d.zip | |
launcher: optimise wallpaper selector
Optimise thumbnail size
Also limit number shown
Add show all when no search option
Diffstat (limited to 'src/services/wallpapers.ts')
| -rw-r--r-- | src/services/wallpapers.ts | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/services/wallpapers.ts b/src/services/wallpapers.ts index 77b22ad..2dfc8aa 100644 --- a/src/services/wallpapers.ts +++ b/src/services/wallpapers.ts @@ -6,7 +6,11 @@ import Monitors from "./monitors"; export interface IWallpaper { path: string; - thumbnail?: string; + thumbnails: { + compact: string; + medium: string; + large: string; + }; } export interface ICategory { @@ -84,7 +88,16 @@ export default class Wallpapers extends GObject.Object { const files = successes.map(r => r.files.replaceAll("\n", " ")).join(" "); const list = (await execAsync(["fish", "-c", `identify -ping -format '%i\n' ${files} ; true`])).split("\n"); - this.#list = await Promise.all(list.map(async p => ({ path: p, thumbnail: await Thumbnailer.thumbnail(p) }))); + this.#list = await Promise.all( + list.map(async p => ({ + path: p, + thumbnails: { + compact: await Thumbnailer.thumbnail(p, { width: 60, height: 60, exact: true }), + medium: await Thumbnailer.thumbnail(p, { width: 400, height: 150, exact: true }), + large: await Thumbnailer.thumbnail(p, { width: 400, height: 200, exact: true }), + }, + })) + ); this.#list.sort((a, b) => a.path.localeCompare(b.path)); this.notify("list"); |