xenon-widgets
v1.2.0Widgets, themes and animated backgrounds for the Xenon dashboard: SDK, install, errors, screenshots.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
xenon_status
Check that Xenon is running on this computer and ready for widgets: its version, the Widget SDK version, whether community widgets are on and whether a dashboard is open. Call it first.
sdk_reference
Read the Xenon Widget SDK reference: the manifest, the message protocol, data streams, actions, storage, sizing and the sandbox rules. With no section you get the table of contents. Read it before writing a widget.
| Parameter | Type | Description |
|---|---|---|
section | string | A section name from the table of contents. |
new_widget
Write a working starter widget (manifest, HTML, CSS, JS showing live CPU and memory) into a new or empty folder. Edit it from there, then install_widget.
| Parameter | Type | Description |
|---|---|---|
folder * | string | Absolute path of the widget folder (the one holding manifest.json). Its name is the widget id unless `id` is given. |
bit | boolean | A widget that draws the person's own Bit (Xenon 5.3): the "bit" stream and action, and bit-kit.js, the Bit engine the widget loads before its script. |
id | string | Widget id: 2 to 41 characters, a-z, 0-9 and dashes. |
name | string | The name people see. Defaults to the id. |
overwrite | boolean | Replace files with the same names in a folder that is not empty. |
pump | boolean | Also made for the round screen on an AIO pump cooler (Xenon 5.3): manifest "pump": true and a layout that stays inside the circle. |
pumpStyle | boolean | A whole pump screen's style (Xenon 5.3), offered beside Xenon and Gauge: "pump" and "pumpStyle" in the manifest, and the widget draws the line placement.line names and moves the ring of lights with pu… |
size | string | Tile size. Defaults to medium. |
check_widget
Run the checks Xenon runs before installing, without installing: the package rules, what the sandbox will refuse (inline scripts, remote code, hosts) and the Store's review notes.
| Parameter | Type | Description |
|---|---|---|
folder * | string | Absolute path of the widget folder (the one holding manifest.json). Its name is the widget id unless `id` is given. |
id | string | Widget id: 2 to 41 characters, a-z, 0-9 and dashes. |
install_widget
Install or update the widget from its folder put it on the dashboard and show its page (a new page when the one in view is full). Permissions it asks for still wait for the person to approve them on the dashboard. Then call widget_issues and widget_screenshot.
| Parameter | Type | Description |
|---|---|---|
folder * | string | Absolute path of the widget folder (the one holding manifest.json). Its name is the widget id unless `id` is given. |
id | string | Widget id: 2 to 41 characters, a-z, 0-9 and dashes. |
widget_issues
What went wrong in an installed widget while it ran: errors and console.error lines, requests the sandbox blocked, whether its permissions are approved, how heavy it is, and what its tile cuts off (fit: a part past the edge of the tile, text its box cuts or that runs out of it, by class name and pixels, measured a few seconds after it drew; an empty list means it all fits). Errors thrown in widget code show as "Script error." because of the sandbox: wrap code in try/catch and console.error the message to see it.
| Parameter | Type | Description |
|---|---|---|
id * | string | Widget id: 2 to 41 characters, a-z, 0-9 and dashes. |
widget_screenshot
A picture of the widget's tile as it is on screen now. Anything on top of the dashboard shows too. Not available on Linux under Wayland.
| Parameter | Type | Description |
|---|---|---|
id * | string | Widget id: 2 to 41 characters, a-z, 0-9 and dashes. |
my_widgets
List the widgets the person made (not Store downloads). With an id and a folder, write that widget's files into the folder to keep working on it.
| Parameter | Type | Description |
|---|---|---|
folder | string | With id: a new or empty folder to write the widget into. |
id | string | Widget id: 2 to 41 characters, a-z, 0-9 and dashes. |
overwrite | boolean | Replace files with the same names in a folder that is not empty. |
preset_reference
Read the exact rules of a theme, animated background or other share code (Xenon 5.3): every field, its range and a minimal valid example. With no kind you get the list of kinds. Read it before writing one. Widgets have their own tools (sdk_reference, new_widget).
| Parameter | Type | Description |
|---|---|---|
kind | string | theme (colours, glass, fonts of the whole dashboard), bg (an animated background), bundle (a package: theme + bg + pages + more), page, deck, topbar, icons, ambient-layout (a native Ambient scene). |
check_preset
Check a theme, animated background or other share code without opening it (Xenon 5.3): what the import would drop or change, design and performance notes, and the share code anyone can paste in Xenon.
| Parameter | Type | Description |
|---|---|---|
data * | object | The preset itself, as preset_reference describes it for this kind. |
kind * | string | theme (colours, glass, fonts of the whole dashboard), bg (an animated background), bundle (a package: theme + bg + pages + more), page, deck, topbar, icons, ambient-layout (a native Ambient scene). |
codeFile | string | Absolute path of a .js file holding a background's code (the body that defines draw(ctx, t, w, h), and optionally drawFront(ctx, t, w, h) for what falls in front of the widgets). It goes into data.cod… |
name | string | The name people see. |
import_preset
Open a theme, animated background or other share code in Xenon's import window on the dashboard (Xenon 5.3). The person reviews and confirms it there; nothing changes before that. Then call dashboard_screenshot.
| Parameter | Type | Description |
|---|---|---|
data * | object | The preset itself, as preset_reference describes it for this kind. |
kind * | string | theme (colours, glass, fonts of the whole dashboard), bg (an animated background), bundle (a package: theme + bg + pages + more), page, deck, topbar, icons, ambient-layout (a native Ambient scene). |
codeFile | string | Absolute path of a .js file holding a background's code (the body that defines draw(ctx, t, w, h), and optionally drawFront(ctx, t, w, h) for what falls in front of the widgets). It goes into data.cod… |
name | string | The name people see. |
dashboard_screenshot
A picture of the whole Xenon dashboard as it is on screen now, to see a theme or background after the person confirmed it (Xenon 5.3). Anything on top of the dashboard shows too. Not available on Linux under Wayland.