ags(scripts): add experimental script to reload ags on code change

This commit is contained in:
retrozinndev
2025-01-23 14:05:24 -03:00
parent 2887ddd38c
commit b533e830a0
2 changed files with 19 additions and 1 deletions
+2 -1
View File
@@ -1,12 +1,13 @@
import { Gio, monitorFile, readFile, Process } from "astal";
import { App } from "astal/gtk3"
import { Bar } from "./window/Bar";
import { runStyleHandler } from "./scripts/style-handler";
import "./scripts/reload-handler";
runStyleHandler();
App.start({
instanceName: "astal",
main() {
Bar(0);
}
+17
View File
@@ -0,0 +1,17 @@
import { Gio, monitorFile, Process } from "astal";
const monitoringPaths = [ "./scripts", "./widget", "./app.ts", "env.d.ts" ];
function restartInstance(instanceName?: string) {
Process.exec_async(`ags run`, () => {});
Process.exec_async(`astal -q ${ instanceName ? instanceName : "astal" }`, () => {});
}
monitoringPaths.map((path: string) => {
monitorFile(
path,
() => {
restartInstance("astal");
}
)
})