Trilium Electron API
    Preparing search index...

    Interface ElectronWindowApi

    Window-level controls: zoom, theme, title bar, full screen, lifecycle, and a handful of main → renderer event subscriptions.

    interface ElectronWindowApi {
        clearCache(): Promise<void>;
        closeWindow(): void;
        createExtraWindow(extraWindowHash: string): void;
        getZoomFactor(): number;
        isAlwaysOnTop(): boolean;
        isDevToolsDocked(): boolean;
        isFullScreen(): boolean;
        isMaximized(): boolean;
        maximizeWindow(): void;
        minimizeWindow(): void;
        onDevToolsDockChanged(callback: (docked: boolean) => void): void;
        onEnterFullScreen(callback: () => void): void;
        onGlobalShortcut(callback: (actionName: string) => void): void;
        onLeaveFullScreen(callback: () => void): void;
        onOpenInSameTab(callback: (noteId: string) => void): void;
        reloadAllWindows(): void;
        reportStartupMetric(metric: "client-full-render"): void;
        restartApp(): void;
        setAlwaysOnTop(enabled: boolean): void;
        setBackgroundMaterial(material: string): void;
        setFullScreen(enabled: boolean): void;
        setNativeThemeSource(source: "system" | "light" | "dark"): void;
        setTitleBarOverlay(
            options: { color: string; height?: number; symbolColor: string },
        ): void;
        setVibrancy(vibrancy: string): void;
        setWindowButtonPosition(position: { x: number; y: number }): void;
        setZoomFactor(factor: number): void;
        showWindow(): void;
        toggleAllWindows(): void;
        toggleDevTools(): void;
        unmaximizeWindow(): void;
    }
    Index
    • Clears the underlying Chromium HTTP cache. Resolves once the cache is empty.

      Returns Promise<void>

    • Closes the current window.

      Returns void

    • Opens a new top-level Trilium window navigated to the given hash route.

      Parameters

      • extraWindowHash: string

        The URL hash fragment (without the leading #) for the new window.

      Returns void

    • Returns the current page zoom factor (1.0 = 100%).

      Returns number

    • Synchronously returns whether the window is pinned above all others.

      Returns boolean

    • Synchronously returns whether DevTools is currently open and docked into this window (as opposed to detached into a separate window).

      Returns boolean

    • Synchronously returns whether the window is currently in full-screen mode.

      Returns boolean

    • Synchronously returns whether the window is currently maximized.

      Returns boolean

    • Maximizes the current window to fill the available screen area.

      Returns void

    • Minimizes the current window to the taskbar / dock.

      Returns void

    • Subscribes to changes of the DevTools docking state. docked is true only while DevTools is attached to this window — where Chromium disables the native window material (Mica / vibrancy) — and false when it is closed or in a separate window.

      Parameters

      • callback: (docked: boolean) => void

      Returns void

    • Registers a callback fired whenever the window enters full-screen mode.

      Parameters

      • callback: () => void

      Returns void

    • Subscribes to globally registered keyboard shortcuts. The callback receives the logical action name (not the keystroke).

      Parameters

      • callback: (actionName: string) => void

      Returns void

    • Registers a callback fired whenever the window leaves full-screen mode.

      Parameters

      • callback: () => void

      Returns void

    • Subscribes to "open note in active tab" requests originating from outside the renderer (e.g. tray menu, deep links).

      Parameters

      • callback: (noteId: string) => void

      Returns void

    • Triggers a hard reload of every open Trilium window.

      Returns void

    • Reports a renderer startup milestone to the main process, which records it relative to OS process creation alongside the main-process startup metrics. Only the first report of each metric is recorded; later reports (e.g. after a window reload or from extra windows) are ignored.

      Parameters

      • metric: "client-full-render"

      Returns void

    • Quits the app and immediately relaunches it.

      Returns void

    • Toggles the always-on-top (pinned) state of the window.

      Parameters

      • enabled: boolean

      Returns void

    • Sets the Windows 11 backdrop material (e.g. "mica", "acrylic", "tabbed", "none") applied behind the window contents. No-op on other platforms.

      Parameters

      • material: string

      Returns void

    • Enters or leaves full-screen mode.

      Parameters

      • enabled: boolean

      Returns void

    • Overrides the operating system's reported color scheme for this app. Use "system" to follow the OS setting.

      Parameters

      • source: "system" | "light" | "dark"

      Returns void

    • Customizes the Windows and Linux native title bar overlay (the area containing the minimize / maximize / close buttons). height also controls their vertical placement, since the buttons are centred within the overlay. It is given in device-independent pixels, which the page zoom does not scale — see setWindowButtonPosition.

      Parameters

      • options: { color: string; height?: number; symbolColor: string }

      Returns void

    • Sets the macOS vibrancy effect (e.g. "sidebar", "under-window", "fullscreen-ui") applied behind the window contents. No-op on other platforms.

      Parameters

      • vibrancy: string

      Returns void

    • Repositions the macOS traffic-light window buttons. Coordinates are relative to the window's top-left corner and given in device-independent pixels: the buttons are drawn by the system rather than by the page, so unlike the surrounding chrome they are unaffected by the page zoom factor and callers have to scale the offsets themselves.

      Parameters

      • position: { x: number; y: number }

      Returns void

    • Sets the page zoom factor for the current window.

      Parameters

      • factor: number

        1.0 is 100%; e.g. 1.2 zooms to 120%.

      Returns void

    • Brings the main window to the foreground, restoring it if minimized.

      Returns void

    • Shows all hidden windows or hides all visible ones — used by the "show/hide app" global shortcut and tray menu entry.

      Returns void

    • Opens or closes Chromium DevTools for the current window.

      Returns void

    • Restores the window from a maximized state to its previous size.

      Returns void