@vestra-player/sdk - v1.11.3
    Preparing search index...

    Interface Windows

    Create tool windows: separate windows drawn from the plugin's .slint files. plugin.windows.

    Use a tool window for something the user opens, works with and closes: a picture adjustment panel, an inspector, an editor. For content that should stay inside the player's main window, mount a panel; for preferences, add a settings page; for a yes/no question, use Dialogs.confirm. A plugin can have any number of windows.

    A Bookmark window opens from Playback ▸ Bookmark…. create returns a handle without opening anything; its bindings and callbacks are set up first, and show opens the window when the command runs.

    const bookmarkWindow = plugin.windows.create("ui/bookmark.slint");
    // Re-evaluated after every handler and player change; only changes are sent.
    bookmarkWindow.bind(() => ({
    label: mark === null ? "No bookmark" : `Bookmark: ${mark.toFixed(1)} s`,
    canMark: player.state.position !== null,
    canJump: mark !== null && player.state.can.seek,
    }));
    // The Slint callbacks `mark` and `jump` of ui/bookmark.slint.
    bookmarkWindow.on("mark", () => {
    mark = player.state.position;
    return storage.session.set("mark", mark);
    });
    bookmarkWindow.on("jump", () => player.seek(mark!));
    plugin.commands.add({
    id: "bookmark.open",
    path: ["@playback", "Bookmark…"],
    order: 270,
    run: async () => {
    await bookmarkWindow.show(); // opens it, or brings back the open one
    feed ??= player.stream(() => {});
    },
    });

    1.0.0

    interface Windows {
        create(file: string, options?: { id?: string }): Window;
    }
    Index
    • Create a window handle for a .slint file; nothing opens until Window.show.

      Parameters

      • file: string

        Path relative to the package directory, with / on every system, for example "ui/picture.slint". It must stay inside the package.

      • Optionaloptions: { id?: string }

        id: the window's name, unique among this plugin's windows until the window is disposed. Default: the file name without its extension (ui/picture.slint → picture). Give distinct ids to open the same file more than once.

      Returns Window

      A Window owned by this scope.

      The file must export exactly one component, usually export component Name inherits Window; helper components without export are allowed. The window's properties and callbacks are declared on that component. The file is not read here: a missing or broken file makes Window.show reject.

      Bind every callback with View.on before the first show().

      conflict (throws) This plugin already has a window with this id.

      Two compare windows open side by side, one labelled A and one B. A window's id defaults to its file name, so the second window of the same file needs its own id; each handle has its own properties.

      const left = plugin.windows.create("ui/compare.slint", { id: "compare-left" });
      const right = plugin.windows.create("ui/compare.slint", { id: "compare-right" });
      left.set({ side: "A" });
      right.set({ side: "B" });
      await Promise.all([left.show(), right.show()]);

      1.0.0