diff --git a/features/scripts/utils/nomarchy-launch-walker b/features/scripts/utils/nomarchy-launch-walker index ad09f29..da9b4ef 100644 --- a/features/scripts/utils/nomarchy-launch-walker +++ b/features/scripts/utils/nomarchy-launch-walker @@ -8,12 +8,20 @@ if command -v walker >/dev/null 2>&1; then # /dev/null. If they inherit stdout from a $(...) caller (e.g. nomarchy-menu # doing `$(menu ...)`), bash waits for those fds to close on every return, # which hangs the terminal after each menu selection. - if ! pgrep -x elephant > /dev/null; then + # Prefer the Home Manager systemd user services (programs.walker.runAsService). + # The manual fallbacks below MUST check the services first: the service runs + # the wrapped binary `.elephant-wrapped`, which `pgrep -x elephant` never + # matches — so the old check spawned a *second*, competing elephant on every + # menu invocation, racing the service for the socket. Only hand-start when no + # service and no process exists (e.g. walker used outside the HM service). + if ! systemctl --user is-active --quiet elephant.service 2>/dev/null \ + && ! pgrep -x elephant >/dev/null && ! pgrep -f elephant-wrapped >/dev/null; then setsid uwsm-app -- elephant /dev/null 2>&1 & disown fi - if ! pgrep -f "walker --gapplication-service" > /dev/null; then + if ! systemctl --user is-active --quiet walker.service 2>/dev/null \ + && ! pgrep -f "walker --gapplication-service" >/dev/null; then setsid uwsm-app -- walker --gapplication-service /dev/null 2>&1 & disown fi