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:
retrozinndev
2025-03-12 14:11:42 -03:00
parent 0ce13b47be
commit f0cec3ff84
7 changed files with 244 additions and 220 deletions
+12 -8
View File
@@ -1,14 +1,18 @@
import { ResultWidget, ResultWidgetProps } from "../../widget/runner/ResultWidget";
import AstalHyprland from "gi://AstalHyprland";
import { GLib } from "astal";
import { Runner } from "../../window/Runner";
export function handleShell(command: string): ResultWidget {
const userShell = GLib.getenv("SHELL") || "/usr/bin/env bash";
export class PluginShell implements Runner.Plugin {
public readonly prefix = '!';
#shell = GLib.getenv("SHELL") || "/usr/bin/env sh";
return new ResultWidget({
onClick: () => AstalHyprland.get_default().dispatch("exec", `${userShell} -c "${command}"`),
title: `Run: \`${command}\``,
description: userShell,
icon: "utilities-terminal-symbolic"
} as ResultWidgetProps);
public handle(command: string): ResultWidget {
return new ResultWidget({
onClick: () => AstalHyprland.get_default().dispatch("exec", `${this.#shell} -c "${command}"`),
title: `Run: \`${command}\``,
description: this.#shell,
icon: "utilities-terminal-symbolic"
} as ResultWidgetProps)
}
}