From e5251d23f158c7cc092121c3a7cc0438a73746ec Mon Sep 17 00:00:00 2001 From: Aylur Date: Mon, 15 Jul 2024 22:09:58 +0200 Subject: remove python and node I have no desire to work on the python version The node version has the issue of promises not working which makes it unusable but gjs works just as good if not better. Might look back into node later --- node/src/application.ts | 78 ------------------------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 node/src/application.ts (limited to 'node/src/application.ts') diff --git a/node/src/application.ts b/node/src/application.ts deleted file mode 100644 index 13a999c..0000000 --- a/node/src/application.ts +++ /dev/null @@ -1,78 +0,0 @@ -import gi from "node-gtk" -const Astal = gi.require("Astal", "0.1") - -type RequestHandler = { - (request: string, res: (response: any) => void): void -} - -type Config = Partial<{ - instanceName: string - gtkTheme: string - iconTheme: string - cursorTheme: string - css: string - requestHandler: RequestHandler - hold: boolean -}> - -class AstalJS extends Astal.Application { - static GTypeName = "AstalJS" - static { gi.registerClass(this) } - - eval(body: string): Promise { - return new Promise((res, rej) => { - try { - const fn = Function(`return (async function() { - ${body.includes(";") ? body : `return ${body};`} - })`) - fn()() - .then(res) - .catch(rej) - } catch (error) { - rej(error) - } - }) - } - - requestHandler?: RequestHandler - - vfunc_request(msg: string, conn: any): void { - if (typeof this.requestHandler === "function") { - this.requestHandler(msg, response => { - Astal.writeSock(conn, String(response), (_, res) => - Astal.writeSockFinish(res), - ) - }) - } else { - // @ts-expect-error missing type - super.vfunc_request(msg, conn) - } - } - - start( - { requestHandler, css, ...cfg }: Omit = {}, - callback?: (args: string[]) => any, - ) { - Object.assign(this, cfg) - - this.requestHandler = requestHandler - this.on("activate", () => { - callback?.(process.argv) - }) - - if (!this.acquireSocket()) { - console.error(`Astal instance "${this.instanceName}" already running`) - process.exit() - } - - if (css) - this.applyCss(css, false) - - // FIXME: promises never resolve - // https://github.com/romgrk/node-gtk/issues/121 - // https://gitlab.gnome.org/GNOME/gjs/-/issues/468 - App.run([]) - } -} - -export const App = new AstalJS -- cgit v1.2.3