ags(runner): add new functions and organize existing

This commit is contained in:
retrozinndev
2025-05-11 20:53:19 -03:00
parent ae1d29bc89
commit c574fa87f9
3 changed files with 253 additions and 225 deletions
+1 -3
View File
@@ -26,9 +26,7 @@ export 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
new RegExp(`${search.split('').map(c =>
`.*(${c.toLowerCase()}|${c.toUpperCase()}).*`).join('')}`
).test(file.split('/')[file.split('/').length-1])
Runner.regExMatch(search, file.split('/')[file.split('/').length-1])
).map(path => new ResultWidget({
title: path.split('/')[path.split('/').length-1].replace(/\..*$/, ""),
onClick: () => Wallpaper.getDefault().setWallpaper(path)