e02f96b151
I call it "provisory" because I don't have a Wi-Fi card to test it, but in theory, everything should work
32 lines
939 B
TypeScript
32 lines
939 B
TypeScript
import { exec, execAsync, Gio, GLib } from "astal";
|
|
|
|
export const decoder = new TextDecoder("utf-8"),
|
|
encoder = new TextEncoder();
|
|
|
|
export function getHyprlandInstanceSig(): (string|null) {
|
|
return GLib.getenv("HYPRLAND_INSTANCE_SIGNATURE");
|
|
}
|
|
|
|
export function getHyprlandVersion(): string {
|
|
return exec(`${GLib.getenv("HYPRLAND_CMD") || "Hyprland"} --version | head -n1`).split(" ")[1];
|
|
}
|
|
|
|
export function makeDirectory(dir: string): void {
|
|
execAsync([ "mkdir", "-p", dir ]);
|
|
}
|
|
|
|
export function deleteFile(path: string): void {
|
|
execAsync([ "rm", "-r", path ]);
|
|
}
|
|
|
|
export function isInstalled(commandName: string): boolean {
|
|
const proc = Gio.Subprocess.new(["bash", "-c", `command -v ${commandName}`],
|
|
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE);
|
|
|
|
const [ , stdout, stderr ] = proc.communicate_utf8(null, null);
|
|
if(stdout && !stderr)
|
|
return true;
|
|
|
|
return false;
|
|
}
|