💥 ags(arg-handler): do not async requestHandler, remove inline js function from cli

This commit is contained in:
retrozinndev
2025-04-21 17:39:47 -03:00
parent a0f0dcf90a
commit 5a46ef9d62
2 changed files with 3 additions and 11 deletions
+2 -2
View File
@@ -32,8 +32,8 @@ const runnerPlugins: Array<Runner.Plugin> = [
App.start({
instanceName: "astal",
requestHandler: async (request: string, response: (result: any) => void): Promise<void> => {
response(await handleArguments(request));
requestHandler: (request: string, response: (result: any) => void): void => {
response(handleArguments(request));
},
main: (..._args: Array<string>) => {
console.log(`[LOG] Initialized astal instance as: ${ App.instanceName || "astal" }`);
+1 -9
View File
@@ -5,10 +5,9 @@ import { restartInstance } from "./reload-handler";
import { startRunnerDefault } from "../runner/Runner";
import { showWorkspaceNumbers } from "../widget/bar/Workspaces";
import { timeout } from "astal";
import { App } from "astal/gtk3";
export async function handleArguments(request: string): Promise<any> {
export function handleArguments(request: string): any {
const args: Array<string> = request.split(" ");
switch(args[0]) {
case "open":
@@ -42,12 +41,6 @@ export async function handleArguments(request: string): Promise<any> {
}
return "Showing numbers";
case "c":
case "code":
const input = request.replace(args[0], "").trimStart();
console.log(input);
return await (App.eval(input).then((v) => v).catch((r) => r));
default:
return "command not found! try checking help";
}
@@ -171,7 +164,6 @@ Options:
reload: creates a new astal instance and removes this one.
volume: wireplumber volume controller, see "volume help".
runner: open the application runner.
c, code [js]: runs provided js in args and returns result.
show-ws-numbers: show or hide workspace numbers in bar.
h, help: shows this help message.