Skip to Content

App API

dmn.app

App-level control including boot, restart, and external URLs.

Automatic update is main-window only. Restart and quit wait for pending editor writes in every native Tauri window before the process exits.

dmn.app.bootstrap(): Promise<Bootstrap>

Returns app bootstrap data (settings, keys, presets, etc.)

const bootstrap = await dmn.app.bootstrap(); // Bootstrap properties console.log(bootstrap.selectedKeyType); // current layout mode ID (e.g. '4key') console.log(bootstrap.tabOrder); // display order of built-in and custom tabs console.log(bootstrap.barCount); // how many leading tabs sit in the toolbar bar console.log(bootstrap.settings); // app settings object console.log(bootstrap.keys['4key']); // key mapping (KeySlot union entries) console.log(bootstrap.keyCounters); // counter state console.log(bootstrap.keyCountersSessionId); // counter stream session console.log(bootstrap.keyCountersRevision); // counter snapshot revision

bootstrap.keys carries the same KeySlot union (string | MultiKeySlot) as dmn.keys.get(). Consumers that assume plain string slots should handle both shapes - see the Keys API.

keyCountersRevision is a read-only, monotonically increasing watermark for the returned keyCounters snapshot. It is intended for ordering bootstrap snapshots against live counter updates within the same keyCountersSessionId. A changed session ID starts a new revision sequence.

dmn.app.restart(): Promise<void>

Restarts the app. Settings are preserved.

await dmn.app.restart();

dmn.app.openExternal(url: string): Promise<void>

Opens a URL in the system default browser.

await dmn.app.openExternal('https://dmstudio.app');

dmn.window

Window management API.

dmn.window.type: WindowType

Returns the current window type.

type WindowType = 'main' | 'overlay'; console.log(dmn.window.type); // 'main' or 'overlay'

dmn.window.minimize(): Promise<void>

Minimizes the current window.

await dmn.window.minimize();

dmn.window.close(): void

Closes the current window.

dmn.window.close();

dmn.window.openDevtoolsAll(): Promise<void>

Opens DevTools for all windows. Useful for debugging.

await dmn.window.openDevtoolsAll();

Example Usage

// App info display dmn.plugin.defineElement({ name: 'App Info', maxInstances: 1, template: (state, settings, { html }) => html` <div style="background: #333; padding: 16px; border-radius: 8px;"> <div>Window: ${dmn.window.type}</div> <div>Mode: ${state.mode ?? 'loading...'}</div> </div> `, onMount: ({ setState }) => { dmn.app.bootstrap().then((boot) => { setState({ mode: boot.selectedKeyType }); }); }, });