From 9c1cd7362b2d946de81ac17fe0d66f19ffbfa46f Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Sat, 17 May 2025 19:02:27 -0300 Subject: [PATCH] :boom: ags(scripts/utils): actually fix the `isInstalled()` method --- ags/scripts/utils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ags/scripts/utils.ts b/ags/scripts/utils.ts index 9d2efe0..1204f17 100644 --- a/ags/scripts/utils.ts +++ b/ags/scripts/utils.ts @@ -1,4 +1,4 @@ -import { exec, execAsync, GLib } from "astal"; +import { exec, execAsync, Gio, GLib } from "astal"; export function getHyprlandInstanceSig(): (string|null) { @@ -18,8 +18,11 @@ export function deleteFile(path: string): void { } export function isInstalled(commandName: string): boolean { - const output = exec(["bash", "-c", `command -v ${commandName}`]); - if(output) + 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;