summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gjs/src/application.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/gjs/src/application.ts b/gjs/src/application.ts
index 4a184e1..6a75d46 100644
--- a/gjs/src/application.ts
+++ b/gjs/src/application.ts
@@ -1,4 +1,4 @@
-import { Astal, GObject, Gio } from "./imports.js"
+import { Astal, GObject, Gio, GLib } from "./imports.js"
type RequestHandler = {
(request: string, res: (response: any) => void): void
@@ -67,7 +67,18 @@ class AstalJS extends Astal.Application {
setConsoleLogDomain(this.instanceName)
this.requestHandler = requestHandler
- this.connect("activate", () => main?.(...programArgs))
+ this.connect("activate", () => {
+ // @ts-expect-error missing url type
+ const path: string[] = import.meta.url.split("/").slice(3)
+ const file = path.at(-1)!.replace(".js", ".css")
+ const css = `/${path.slice(0, -1).join("/")}/${file}`
+ print(path, css)
+ if (GLib.file_test(css, GLib.FileTest.EXISTS))
+ this.apply_css(css, false)
+
+ main?.(...programArgs)
+ })
+
if (!this.acquire_socket())
return client(msg => this.message(msg)!, ...programArgs)