chore(runner): try a new approach to show results, make plugins return properties instead of the actual widget

returning the results as objects seems to be a better approach, also, the new way of showing results doesn't work for some reason(i didn't discover it yet lol)
This commit is contained in:
retrozinndev
2025-07-23 20:41:23 -03:00
parent 69b098b6bd
commit 467de2235a
9 changed files with 278 additions and 242 deletions
+7 -7
View File
@@ -1,6 +1,5 @@
import { Wallpaper } from "../../scripts/wallpaper";
import { Runner } from "../Runner";
import { ResultWidget, ResultWidgetProps } from "../../widget/runner/ResultWidget";
import Gio from "gi://Gio?version=2.0";
@@ -26,18 +25,19 @@ class _PluginWallpapers implements Runner.Plugin {
handle(search: string) {
if(this.#files!.length > 0)
return this.#files!.filter(file => // not the best way to search, but it works
return this.#files!.filter(file =>
// also not the best way to search, but it works
Runner.regExMatch(search, file.split('/')[file.split('/').length-1])
).map(path => new ResultWidget({
).map(path => ({
title: path.split('/')[path.split('/').length-1].replace(/\..*$/, ""),
onClick: () => Wallpaper.getDefault().setWallpaper(path)
} as ResultWidgetProps));
actionClick: () => Wallpaper.getDefault().setWallpaper(path)
}));
return new ResultWidget({
return {
title: "No wallpapers found!",
description: "Define the $WALLPAPERS variable on Hyprland or create a ~/wallpapers directory",
icon: "image-missing-symbolic"
} as ResultWidgetProps);
};
}
}