Skip to content

fix(RunningApp): detect apps that exit before creating a window - #562

Open
loki666 wants to merge 2 commits into
ShadowBlip:mainfrom
loki666:fix/running-app-exit-before-window
Open

loki666 wants to merge 2 commits into
ShadowBlip:mainfrom
loki666:fix/running-app-exit-before-window

Conversation

@loki666

@loki666 loki666 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Problem

RunningApp.update() only learns an app's type (X11 or Wayland) from its first window, and only the X11 and Wayland paths run the is_running() checks that move an app to STOPPED. While the type is still UNKNOWN, nothing checks whether the process is still alive.

So an app that exits before it creates any window stays in the running list forever. A launcher script that fails at once is one example, as is a game binary that crashes on start. The loading screen never goes away, and EXIT lifecycle hooks never run. The player has to open the running-app menu and pick Exit by hand.

Changes

While the app's type is still unknown, update() marks it STOPPED (and emits app_killed) as soon as is_running() fails. It doesn't wait out the X11/Wayland grace of four failed checks: the tracked PID is the reaper, which only exits once every process of the app has. That makes the loading screen clear within one check_running() tick (~1 s).

Apps that do create a window are unchanged: once their type is detected, the existing X11/Wayland paths handle them as before.

Testing

Tested on an AYANEO Pocket ACE (aarch64): a library item whose launch command exits with an error in ~20 ms, before any window. Before: the loading screen stayed up indefinitely and the item's EXIT hook never ran. After: the app is removed from the running list 0.6 s after launch, the EXIT hook runs, and the menu comes back. Normal game launches and exits are unaffected.

loki666 and others added 2 commits October 4, 2026 17:33
An app's type (X11 or Wayland) is only discovered once it has a window,
and the is_running() checks that move an app to STOPPED only run for a
known type. An app that exits before creating any window, such as a
launcher script that fails at once, therefore stays in the running list
forever: the loading screen never goes away and EXIT lifecycle hooks
never run. While the type is still unknown, mark the app stopped as soon
as is_running() fails; no grace period is needed, as the tracked process
(the reaper) only exits once all of the app's processes have.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants