♻️ ags(runner): organize files separately from the main shell stuff

This commit is contained in:
retrozinndev
2025-03-12 22:11:18 -03:00
parent 65143468c5
commit 52cfd114d7
13 changed files with 62 additions and 109 deletions
+1 -1
View File
@@ -2,9 +2,9 @@ import { Gtk } from "astal/gtk3";
import { Windows } from "../windows";
import { restartInstance } from "./reload-handler";
import { Wireplumber } from "./volume";
import { startRunnerDefault } from "../window/Runner";
import { AskPopup } from "../widget/AskPopup";
import { execAsync } from "astal";
import { startRunnerDefault } from "../runner/Runner";
export function handleArguments(request: string): any {
const args: Array<string> = request.split(" ");
+6
View File
@@ -134,6 +134,12 @@ class Notifications extends GObject.Object {
this.emit("notification-removed", notification.id);
}
public toggleDoNotDisturb(): boolean {
if(AstalNotifd.get_default().dontDisturb) {
}
}
connect(signal: string, callback: (...args: any[]) => void): number {
return super.connect(signal, callback);
}
-21
View File
@@ -1,21 +0,0 @@
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 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;
}
}
-18
View File
@@ -1,18 +0,0 @@
import { ResultWidget, ResultWidgetProps } from "../../widget/runner/ResultWidget";
import AstalHyprland from "gi://AstalHyprland";
import { GLib } from "astal";
import { Runner } from "../../window/Runner";
export class PluginShell implements Runner.Plugin {
public readonly prefix = '!';
#shell = GLib.getenv("SHELL") || "/usr/bin/env sh";
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)
}
}
-40
View File
@@ -1,40 +0,0 @@
import AstalHyprland from "gi://AstalHyprland";
import { ResultWidget, ResultWidgetProps } from "../../widget/runner/ResultWidget";
import { Runner } from "../../window/Runner";
const searchEngines = {
duckduckgo: "https://duckduckgo.com/?q=",
google: "https://google.com/search?q=",
yahoo: "https://search.yahoo.com/search?p="
};
let engine: string = searchEngines.google;
export class PluginWebSearch implements Runner.Plugin {
#engineString: string;
public readonly prefix = '?';
public readonly name = "Web Search";
constructor() {
switch(engine) {
case searchEngines.google:
this.#engineString = "Google";
case searchEngines.yahoo:
this.#engineString = "Yahoo";
case searchEngines.duckduckgo:
this.#engineString = "DuckDuckGo";
default: this.#engineString = "Web";
}
}
public handle(search: string): ResultWidget {
return new ResultWidget({
icon: "system-search-symbolic",
title: search || "",
description: `Search with ${this.#engineString}`,
onClick: () => AstalHyprland.get_default().dispatch(
"exec",
`xdg-open \"${engine + search}\"`
)
} as ResultWidgetProps);
}
}