⚡ perf(ags/runner): better code for runner, show results from multiple plugins, use interface to make plugins and more perfomance implementations
This commit is contained in:
@@ -2,14 +2,20 @@ import AstalHyprland from "gi://AstalHyprland";
|
||||
import { getAstalApps } from "../apps";
|
||||
import { ResultWidget, ResultWidgetProps } from "../../widget/runner/ResultWidget";
|
||||
import AstalApps from "gi://AstalApps";
|
||||
import { Runner } from "../../window/Runner";
|
||||
|
||||
export function handleApplications(search: string): (Array<ResultWidget>|null) {
|
||||
return getAstalApps().fuzzy_query(search).map((app: AstalApps.Application) =>
|
||||
new ResultWidget({
|
||||
title: app.get_name(),
|
||||
description: app.get_description(),
|
||||
icon: app.iconName,
|
||||
onClick: () => AstalHyprland.get_default().dispatch("exec", app.get_executable())
|
||||
} as ResultWidgetProps)
|
||||
) || null;
|
||||
export class PluginApps implements Runner.Plugin {
|
||||
// Do not provide prefix, so it's always ran.
|
||||
public readonly name = "Apps";
|
||||
|
||||
public handle(text: string) {
|
||||
return getAstalApps().fuzzy_query(text).map((app: AstalApps.Application) =>
|
||||
new ResultWidget({
|
||||
title: app.get_name(),
|
||||
description: app.get_description(),
|
||||
icon: app.iconName,
|
||||
onClick: () => AstalHyprland.get_default().dispatch("exec", app.get_executable())
|
||||
} as ResultWidgetProps)
|
||||
) || null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user