✨ ags(scripts): add experimental script to reload ags on code change
This commit is contained in:
+2
-1
@@ -1,12 +1,13 @@
|
|||||||
import { Gio, monitorFile, readFile, Process } from "astal";
|
|
||||||
import { App } from "astal/gtk3"
|
import { App } from "astal/gtk3"
|
||||||
|
|
||||||
import { Bar } from "./window/Bar";
|
import { Bar } from "./window/Bar";
|
||||||
import { runStyleHandler } from "./scripts/style-handler";
|
import { runStyleHandler } from "./scripts/style-handler";
|
||||||
|
import "./scripts/reload-handler";
|
||||||
|
|
||||||
runStyleHandler();
|
runStyleHandler();
|
||||||
|
|
||||||
App.start({
|
App.start({
|
||||||
|
instanceName: "astal",
|
||||||
main() {
|
main() {
|
||||||
Bar(0);
|
Bar(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user