💥 ags(arg-handler): do not async requestHandler, remove inline js function from cli
This commit is contained in:
+2
-2
@@ -32,8 +32,8 @@ const runnerPlugins: Array<Runner.Plugin> = [
|
|||||||
|
|
||||||
App.start({
|
App.start({
|
||||||
instanceName: "astal",
|
instanceName: "astal",
|
||||||
requestHandler: async (request: string, response: (result: any) => void): Promise<void> => {
|
requestHandler: (request: string, response: (result: any) => void): void => {
|
||||||
response(await handleArguments(request));
|
response(handleArguments(request));
|
||||||
},
|
},
|
||||||
main: (..._args: Array<string>) => {
|
main: (..._args: Array<string>) => {
|
||||||
console.log(`[LOG] Initialized astal instance as: ${ App.instanceName || "astal" }`);
|
console.log(`[LOG] Initialized astal instance as: ${ App.instanceName || "astal" }`);
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import { restartInstance } from "./reload-handler";
|
|||||||
import { startRunnerDefault } from "../runner/Runner";
|
import { startRunnerDefault } from "../runner/Runner";
|
||||||
import { showWorkspaceNumbers } from "../widget/bar/Workspaces";
|
import { showWorkspaceNumbers } from "../widget/bar/Workspaces";
|
||||||
import { timeout } from "astal";
|
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(" ");
|
const args: Array<string> = request.split(" ");
|
||||||
switch(args[0]) {
|
switch(args[0]) {
|
||||||
case "open":
|
case "open":
|
||||||
@@ -42,12 +41,6 @@ export async function handleArguments(request: string): Promise<any> {
|
|||||||
}
|
}
|
||||||
return "Showing numbers";
|
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:
|
default:
|
||||||
return "command not found! try checking help";
|
return "command not found! try checking help";
|
||||||
}
|
}
|
||||||
@@ -171,7 +164,6 @@ Options:
|
|||||||
reload: creates a new astal instance and removes this one.
|
reload: creates a new astal instance and removes this one.
|
||||||
volume: wireplumber volume controller, see "volume help".
|
volume: wireplumber volume controller, see "volume help".
|
||||||
runner: open the application runner.
|
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.
|
show-ws-numbers: show or hide workspace numbers in bar.
|
||||||
h, help: shows this help message.
|
h, help: shows this help message.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user