pub fn start_primary(
app_id: &str,
on_show: impl Fn() + Send + 'static,
) -> PrimaryHandleExpand description
Registers the current process as the primary instance and begins listening for signals from any subsequently launched instances.
Spawns a background thread that listens on a local socket. When a signal
is received, on_show is called on the background thread and a message is
also sent to PrimaryHandle::check_show for poll-based detection.
This function must be called only after notify_if_running has returned false.
§Arguments
app_id- A unique identifier for the application, must match the one passed tonotify_if_running.on_show- Callback invoked on the listener thread each time a wake-up signal is received.
§Returns
A PrimaryHandle that keeps the listener alive. Dropping it will shut down
the listener and clean up resources.