Goal: make a plugin that feels like part of the player.
These are the rules the built-in plugins follow. Token names, sizes, icons and widgets are in Theme; menu ids, orders and default keys in Commands.
Theme.danger text in an open window.backdrop slot for cover art while nothing plays). A one-click entry point is a bottom-bar button (button in the command's options).vestra.playback, so another plugin's mount there is refused with conflict (the plugin's warning slot-occupied) and never shows. Do not plan on it: controls for what is playing go in the adjust column, content in the sidebar, a tool in a window.Theme token, never a colour value, so it follows the dark and light palettes: Theme.danger for failures, Theme.playing for what plays now, Theme.accent for hover and selection, Theme.accent-fill for fills.Theme.text. A check mark on an accent background is white.Theme.font-mono for code or aligned numbers.font-xs, font-body, font-tab, font-title). A time or counter whose digits must not shift while it changes uses Theme.font-mono: Slint has no font-feature setting, so tabular digits cannot be asked of the UI font.Palette.color-scheme: the player switches it with the palette.@vestra/icons.slint, never a font character (✓ › ▲ ▼ ×), at their box size and coloured by state (Icons). An icon of your own is drawn like the set: lines only, round caps.@vestra/widgets.slint (Button, Slider, ToolTipArea, KeyHint, UrlInputRow), other controls from std-widgets.slint. Sizes, gaps, padding and corners are Theme tokens.KeyHint at the right end of its row and in its tooltip, taking the labels from plugin.commands.keys, never by hand.title.UrlInputRow. A longer form groups its fields with right-aligned labels and ends in one primary button.Theme.playing, Theme.text-played, Theme.selected-bg; a failed item gets the failed icon and an OSD message.Theme.bg-list, no cards, stripes or rounded rows. A list whose length the user decides is a ListView from std-widgets.slint; keep a bare for for a short fixed list.focus: "panel".VestraFocus.release() from @vestra/focus.slint (Focus).content-min-width (and their full width in content-full-width if the bar drops controls when narrow), and lay your row out in the width BarButtonsHost.width leaves (Bar buttons).["@tools", "Screen Ruler…"]); a domain of your own is one top-level submenu (The top level). No "File" or "View" menu.["@video", "Blur"]). Without an order your item goes after the player's; give your related items a group of their own.@reset, titled by what they reset without the word Reset (["@reset", "Picture"]), grouped per domain, and nowhere else.… (one character) when the item opens a window or asks before acting.reason. An empty dynamic list shows one disabled item that says so.▸, never ▶.Ctrl, not Cmd: on macOS it fires for both.@vestra-player/sdk with import type, @vestra-player/sdk/testing only in tests.cmd, open): use plugin.system, plugin.clipboard, plugin.tools or portable Node.js code.node:path, package paths with /, and handle unsupported where a method documents a platform difference.<owner>.<name> with your GitHub user or organization; vestra.* is reserved.Switch the palette (Appearance commands, Ctrl+Shift+P) with your windows open: everything follows at once. Switch the language to German and Japanese and look for clipped text. Compare your tool window with the player's Picture Adjustments window.
A blur tool that follows the rules: it lives in Video and opens a window (…), is greyed out with a reason while nothing plays, confirms with an OSD template, and puts its reset under @reset.
import type { Plugin, VideoFilter } from "@vestra-player/sdk";
export default function activate(plugin: Plugin) {
let amount = 0;
let filter: VideoFilter | undefined; // made on first use: it keeps the plugin running
const apply = () =>
(filter ??= plugin.video.filter("blur")).set(
amount ? [{ kind: "gblur", sigma: amount, steps: 3 }] : [],
);
const blurWindow = plugin.windows.create("ui/blur.slint");
blurWindow.bind(() => ({ amount }));
blurWindow.on("amountChanged", (value: number) => {
amount = value;
apply(); // applies at once: no Apply button
});
plugin.commands.add({
id: "blur",
path: ["@video", "Blur…"], // by subject; … opens a window
enabled: plugin.when.ready, // evaluated by the player
reason: plugin.i18n.text("Nothing is playing"), // shown only while disabled
run: () => blurWindow.show(),
});
plugin.commands.add({
id: "blur.reset",
path: ["@reset", "Blur"], // no word "Reset" in the title
group: "reset-video",
run: () => {
amount = 0;
apply();
return plugin.osd.show("Blur {}", [amount]); // a template
},
});
}