diff --git a/ags/scripts/apps.ts b/ags/scripts/apps.ts index 5741c3a..ccb6c59 100644 --- a/ags/scripts/apps.ts +++ b/ags/scripts/apps.ts @@ -5,9 +5,11 @@ import AstalHyprland from "gi://AstalHyprland"; import { execAsync } from "astal"; +export const uwsmIsActive: boolean = await execAsync( + "uwsm check is-active hyprland-uwsm.desktop" +).then(() => true).catch(() => false); const astalApps: AstalApps.Apps = new AstalApps.Apps(); -const uwsmIsActive: boolean = await execAsync("uwsm check is-active").then((stdout) => - /hyprland/gi.test(stdout)).catch(() => false); + let appsList: Array = astalApps.get_list(); export function getApps(): Array { diff --git a/ags/scripts/reload-handler.ts b/ags/scripts/reload-handler.ts index d04f82a..e4a2de0 100644 --- a/ags/scripts/reload-handler.ts +++ b/ags/scripts/reload-handler.ts @@ -1,11 +1,17 @@ -import { monitorFile, Process } from "astal"; +import { execAsync, Gio, monitorFile } from "astal"; import { App } from "astal/gtk3"; +import { uwsmIsActive } from "./apps"; const monitoringPaths = [ "./scripts", "./window", "./app.ts", "env.d.ts" ]; export function restartInstance(instanceName?: string): void { - Process.exec_async(`astal -q ${ instanceName || App.instanceName || "astal" }`, () => {}); - Process.exec_async(`ags run`, () => {}); + execAsync(`astal -q ${ instanceName ?? 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 { diff --git a/hypr/scripts/exec.sh b/hypr/scripts/exec.sh index 08c3485..c5f787d 100644 --- a/hypr/scripts/exec.sh +++ b/hypr/scripts/exec.sh @@ -8,9 +8,9 @@ # From: https://github.com/retrozinndev/colorshell -if uwsm check is-active; then - exec uwsm-app -- $@ +if uwsm check is-active "hyprland-uwsm.desktop"; then + exec uwsm app -- "$@" exit 0 fi -exec $@ +exec "$@" diff --git a/hypr/shell/autostart.conf b/hypr/shell/autostart.conf index 458e956..1845d16 100644 --- a/hypr/shell/autostart.conf +++ b/hypr/shell/autostart.conf @@ -14,8 +14,8 @@ exec-once = systemctl enable --user --now hyprsunset exec-once = systemctl enable --user --now hyprpaper # Scripts -exec-once = $exec sh $XDG_CONFIG_HOME/hypr/scripts/gen-pywal.sh -exec-once = $exec sleep 3 && sh $XDG_CONFIG_HOME/hypr/scripts/load-hyprsunset.sh # wait some time to actually set the filters +exec-once = sh $XDG_CONFIG_HOME/hypr/scripts/gen-pywal.sh +exec-once = sleep 3 && sh $XDG_CONFIG_HOME/hypr/scripts/load-hyprsunset.sh # wait some time to actually set the filters # Shell exec-once = $exec ags run