//! Single-instance election and activation hand-off.
//!
//! `instance-handoff` takes a per-user lock before any window, tray or hotkey
//! exists. Later launches hand over their request and exit; the owner keeps a
//! local IPC listener alive for its lifetime. The OS releases the lock when
//! the owner exits or crashes, so a stale lock cannot block a future launch.
use std::sync::Mutex;
use iced::futures::{SinkExt, Stream};
use iced::{Subscription, stream};
use instance_handoff::{AppId, Builder, Owner, Request, Started, State};
use tokio::sync::mpsc::{UnboundedReceiver, unbounded_channel};
const APP_ID: AppId = AppId::windowed("dev.moorly.Moorly");
static OWNER: Mutex