aerospace: skip config reload when AeroSpace is not running

Avoid failing Home Manager activation when the generated AeroSpace
configuration changes while AeroSpace is not yet running.

The onChange hook can run before a running AeroSpace instance is
available. Probe the running instance with `aerospace list-modes --current`
before calling `reload-config`, and skip the reload if AeroSpace is not
yet running.
This commit is contained in:
kinnrai
2026-05-20 18:41:44 +08:00
committed by Austin Horstman
parent f15c764b14
commit 58e05d16d7

View File

@@ -208,7 +208,11 @@ in
onChange = lib.mkIf cfg.launchd.enable ''
echo "AeroSpace config changed, reloading..."
${lib.getExe cfg.package} reload-config
if ${lib.getExe cfg.package} list-modes --current >/dev/null 2>&1; then
${lib.getExe cfg.package} reload-config
else
echo "AeroSpace is not running yet, skipping reload-config."
fi
'';
};
};