Skip to content

API Reference / @gtkx/runtime / runApplication

Function: runApplication() ​

runApplication(application, argv): RunApplicationResult

Defined in: packages/runtime/src/lifecycle.ts:153

Starts a GTKX-created application through GLib's command-line handling, including option parsing, --help, handle-local-options, registration, and activation or forwarding to an existing instance. Keeps the runtime alive while the application is active.

Parameters ​

application ​

ApplicationLike

An application created by GTKX.

argv ​

string[]

Command-line arguments; the first entry is the program name displayed by --help.

Returns ​

RunApplicationResult

Whether this instance may build a UI, and GLib's command-line exit status.

Remarks ​

Node remains the outer event loop. Starting the same application again registers and activates it without reparsing argv; GLib permits command-line parsing only once per instance.

Build a UI only when isPrimary is true. A remote instance has no GtkApplicationImpl, and attaching a window to it crashes.

Before parsing, the application becomes the process-wide default returned by Gio.Application.getDefault(). It remains the default even if registration fails or it is remote, until quitApplication releases it.

Throws ​

If the application was not created by GTKX.