ca187a26ed
the `filter()` function can both filter a common array and at the same time, it can also filter an Accessor Array(Accessor<Array<T>> and return an Accessor when provided Array is an Accessor Array. Stylesheet directory changed to colorshell's cache dir, making sense, since it's a temporary file generated by the shell
29 lines
768 B
TypeScript
29 lines
768 B
TypeScript
import { monitorFile } from "ags/file";
|
|
import { execAsync } from "ags/process";
|
|
import { uwsmIsActive } from "./apps";
|
|
|
|
import App from "ags/gtk4/app";
|
|
import Gio from "gi://Gio?version=2.0";
|
|
|
|
|
|
const monitoringPaths = [ "./scripts", "./window", "./app.ts", "env.d.ts" ];
|
|
|
|
export function restartInstance(): void {
|
|
execAsync(`astal -q ${ App.instanceName ?? "astal" }`);
|
|
Gio.Subprocess.new(
|
|
( uwsmIsActive ?
|
|
[ "uwsm", "app", "--", "ags", "run" ]
|
|
: [ "ags", "run" ]),
|
|
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
|
|
);
|
|
}
|
|
|
|
export function monitorPaths(): void {
|
|
monitoringPaths.map((path: string) => {
|
|
monitorFile(
|
|
path,
|
|
() => restartInstance()
|
|
)
|
|
});
|
|
}
|