Nucleus
Lifecycle

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.

StageModulePage
Cold start and instance lockingcore-runtime (SingleInstanceManager)Single instance
URL and file associationscore-runtime (DeepLinkHandler) + plugin DSLDeep links
Bundle id, version, and vendor at runtimecore-runtime (NucleusApp)App metadata
How the app was packagedcore-runtime (ExecutableRuntime)Executable type
Dock menu (macOS)launcher-macosLauncher: macOS
Taskbar overlays and jump list (Windows)launcher-windowsLauncher: Windows
Unity launcher and quicklist (Linux)launcher-linuxLauncher: Linux
Launch at loginautolaunchAuto-launch
Periodic and cron background workschedulerScheduler
SMAppService agents (macOS)service-management-macosService management
Energy efficiency and keep-awakeenergy-managerEnergy manager
Progress in the dock or taskbartaskbar-progressTaskbar 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-runtime and nucleus-application set up under your main function.