App lifecycle, from cold launch to sleep
The lifecycle modules connect a Nucleus app to the OS events and services that outlive any single window.
The lifecycle modules connect a Nucleus app to the operating-system events and services that outlive any single window: cold launch and instance locking, deep links, dock and taskbar integration, launch at login, background scheduling, and energy management. Each stage is a separate module, and you add only the ones you need.
Modules by lifecycle stage
Each stage maps to a module and a page. The two foundations, core-runtime and
nucleus-application, back several of the rows below.
| Stage | Module | Page |
|---|---|---|
| Cold start and instance locking | core-runtime (SingleInstanceManager) | Single instance |
| URL and file associations | core-runtime (DeepLinkHandler) + plugin DSL | Deep links |
| Bundle id, version, and vendor at runtime | core-runtime (NucleusApp) | App metadata |
| How the app was packaged | core-runtime (ExecutableRuntime) | Executable type |
| Dock menu (macOS) | launcher-macos | Launcher: macOS |
| Taskbar overlays and jump list (Windows) | launcher-windows | Launcher: Windows |
| Unity launcher and quicklist (Linux) | launcher-linux | Launcher: Linux |
| Launch at login | autolaunch | Auto-launch |
| Periodic and cron background work | scheduler | Scheduler |
SMAppService agents (macOS) | service-management-macos | Service management |
| Energy efficiency and keep-awake | energy-manager | Energy manager |
| Progress in the dock or taskbar | taskbar-progress | Taskbar progress |
How it works
Each module wraps the native API for its stage — SMAppService, ITaskbarList3,
NSDockTile, com.canonical.Unity.LauncherEntry, systemd timers, and others — behind a
Kotlin surface, so you keep a single codebase while the app still integrates with each OS
through its own mechanisms. The modules are independent: add only the ones you need, and
each degrades to a no-op on platforms it does not support.
Two modules underpin the rest. core-runtime provides the runtime primitives:
Platform, NucleusApp, SingleInstanceManager, DeepLinkHandler, and
ExecutableRuntime. nucleus-application provides the nucleusApplication { } entry
point, which starts the runtime and initializes those primitives. Read those two pages
first, then the module that matches the behavior you need.
Deep link schemes are declared in the Gradle build with the protocol(name, schemes...)
DSL, which the plugin translates into macOS Apple Events, Windows registry entries, and
Linux .desktop MIME associations at package time.
What's next
- Single instance — enforce one running instance and forward launch arguments to it.
- Deep links — register custom URL schemes and handle incoming URLs.
- Architecture — what
core-runtimeandnucleus-applicationset up under yourmainfunction.