launcher: sort wallpapers and schemes
This commit is contained in:
parent
579070733c
commit
7b6a109ad3
2 changed files with 5 additions and 2 deletions
|
|
@ -386,7 +386,8 @@ export default class Actions extends Widget.Box implements LauncherContent {
|
|||
const scheme = args[1] ?? "";
|
||||
const schemes = Object.values(Schemes.get_default().map)
|
||||
.flatMap(s => (s.colours ? s.name : Object.values(s.flavours!).map(f => `${f.scheme}-${f.name}`)))
|
||||
.filter(s => s !== undefined);
|
||||
.filter(s => s !== undefined)
|
||||
.sort();
|
||||
for (const { target } of fuzzysort.go(scheme, schemes, { all: true })) {
|
||||
if (Schemes.get_default().map.hasOwnProperty(target))
|
||||
this.#content.add(<Scheme {...Schemes.get_default().map[target]} />);
|
||||
|
|
|
|||
|
|
@ -59,13 +59,15 @@ export default class Wallpapers extends GObject.Object {
|
|||
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.sort((a, b) => a.path.localeCompare(b.path));
|
||||
this.notify("list");
|
||||
|
||||
const categories = await Promise.all(successes.map(r => this.#listDir(r.path, "d")));
|
||||
this.#categories = categories
|
||||
.flatMap(c => c.split("\n"))
|
||||
.map(c => ({ path: c, wallpapers: this.#list.filter(w => w.path.startsWith(c)) }))
|
||||
.filter(c => c.wallpapers.length > 0);
|
||||
.filter(c => c.wallpapers.length > 0)
|
||||
.sort((a, b) => a.path.localeCompare(b.path));
|
||||
this.notify("categories");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue