Files
colorshell/ags/runner/plugins/apps.ts
T
retrozinndev 21820ab21c feat(runner/plugins/apps): asynchronously-refresh applications list on init
avoids the necessity to press F5 to update apps list
2025-06-01 16:26:08 -03:00

23 lines
920 B
TypeScript

import { ResultWidget, ResultWidgetProps } from "../../widget/runner/ResultWidget";
import AstalApps from "gi://AstalApps";
import { cleanExec, getAstalApps, updateApps } from "../../scripts/apps";
import { Runner } from "../Runner";
import { Astal } from "astal/gtk3";
export const PluginApps = {
// Do not provide prefix, so it always runs.
name: "Apps",
// asynchronously-refresh apps list on init
init: async () => updateApps(),
handle: (text: string) => {
return getAstalApps().fuzzy_query(text).map((app: AstalApps.Application) =>
new ResultWidget({
title: app.get_name(),
description: app.get_description(),
icon: Astal.Icon.lookup_icon(app.iconName) ? app.iconName : "application-x-executable-symbolic",
onClick: () => cleanExec(app)
} as ResultWidgetProps)
);
}
} as Runner.Plugin;