Port VIctory's lifecycle.rs (GPL-3.0-or-later):
RegisterAppStateChangeNotification / UnregisterAppStateChangeNotification
from the psm-appnotify sets keep the title's routines (the host's are for
packaged apps and never call them), and closing the title's window now
suspends it as the console ends a title: the routines run with
Quiesced = TRUE on a thread of their own, and the process ends when they
return or after a second. Before, the window's close ended the process at
once, with no chance to save.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>