Skip to content

Command Line ​

bash
npm install -g @desktopengine/sdk
desktopengine --help

folder defaults to the current folder. Projects with src/index.ts (or src/index.js) are bundled first and can use import, TypeScript and npm packages; projects without src/ are used as they are, with index.js at the root as the entry. See Projects and Builds.

create ​

bash
desktopengine create <type> <folder> [--renderer <renderer>] [--id <identifier>] [--name <name>]

Creates a project from a template.

ArgumentDescription
<type>wallpaper, widget or companion (pet, its old name, makes a companion too)
<folder>The folder of the new project
--rendererA template drawn another way, only for wallpapers for now: webgl, three, pixi. Run npm install after creating a three or pixi project, see Drawing with WebGL or a rendering library
--idThe manifest's id, com.example.<folder name> by default
--nameThe manifest's name

dev ​

bash
desktopengine dev [folder] [options]

Runs the project in DesktopEngine, rebuilds and reloads it when files change, and prints its console output and uncaught exceptions. Press Ctrl-C to stop.

OptionDescription
--size <id>The widget size: small, medium, large or the id of one of its own; the first of widget.sizes when it isn't one of them
--level desktop|floatingA widget on the desktop (default), or above all windows; companions always float above windows
--display <number>The display to run on, starting at 1; the main display by default
--spanA wallpaper across all displays, when manifest.json declares wallpaper.span
--param <key=value>The value of an option, can be repeated; the others take the manifest's default
--position <x,y>The window position
--port <port>The port to listen on, random by default
--perfShows the frame rate, frame time, CPU, wake-ups and memory, see Performance
--no-openPrints the URL that connects DesktopEngine instead of opening it
--webRuns it in the browser instead, see In the browser

These options stand in for what the user picks in the details pane: the launchOptions your content reads are the same as once installed.

In the browser ​

dev --web runs the project on a page that looks like a Mac desktop, in the web runtime the DesktopEngine store uses to let people try content before they install it. It doesn't need the app, so it works on any computer with a browser; it rebuilds and reloads on changes and prints the console in the terminal like dev. The menu bar of the page switches between light and dark, turns the sound on and starts the content again, for widgets picks the size, and for content that uses them opens more pretend app windows (New Window) and plays an audio file of yours to systemAudio (♫).

The web runtime implements the same JavaScript API on top of the browser: windows are positioned elements, canvases draw with the browser's canvases. Your content only sees what it has in DesktopEngine, so it takes the same paths as in the app: the globals, not window, document or the DOM; and of a canvas, the members, compositing modes, colors, fonts and WebGL extensions DesktopEngine's have. What only a browser has is missing as it is in the app: filter or fontKerning read as undefined, oklch() colors and em font sizes are ignored, and getExtension('WEBGL_lose_context') is null. It is close, not the same: check your content in the app before you publish it. Differences:

  • Requests (fetch, XMLHttpRequest, images and videos) to the domains of network.domains go through a proxy, without cookies; WebSockets go through it too. dev --web's proxy sends every method with its headers and body and passes back the response's headers, as the app does, but the store's preview and its review send GET and HEAD only, without the request's headers other than Accept, and pass back only Content-Type. A request with another method, or with a header the browser asks about first (anything but Accept, Accept-Language, Content-Language and a plain text or form Content-Type, such as Authorization or a JSON Content-Type), fails there: the terminal says when your content sends one.
  • In a 2D canvas, resetClip() and resetCurrentState() only remove the clips made since the last save(), where the app removes them all. Text is drawn by the browser, so glyphs and their widths can differ a little.
  • Files in defile://usr/, localStorage and sessionStorage are kept in memory and gone when the page reloads.
  • Keyboard events never reach the content (as in the app). The wheel reaches widgets and companions where they take the mouse, as in the app; while sound is on, a wheel over content that may play sound can scroll the page too.
  • While the page is hidden (a background tab), the content is paused as in the app, and its timers run on the browser's own, which the browser may slow down more than the app does.
  • DesktopEngine.systemStatus gives a made-up Mac's readings: a web page can't see the computer's (see System Status).
  • DesktopEngine.windows lists the page's pretend app windows: dev --web opens one for content with the window-positions permission, and New Window in the menu bar opens more (see Other Apps' Windows); the store's preview has none.
  • DesktopEngine.systemAudio hears a made-up signal like music, or the audio file you play with ♫ (see What the Mac plays); the store's preview hears the made-up signal.

build ​

bash
desktopengine build [folder] [--minify]

Bundles src/index.(ts|js), the modules and npm packages it imports into one index.js, and puts it with the manifest and assets in dist/package/. --minify makes the bundle smaller.

validate ​

bash
desktopengine validate [folder]

Checks manifest.json and the entry by the app's rules, building src/ first. Exits with status 1 when there are errors, so it fits in CI.

pack ​

bash
desktopengine pack [folder] [--out <folder>] [--minify]

Builds, validates and zips the package into <id>-<version>.zip (in the project's dist/ by default), which File › Import… in DesktopEngine imports.

login ​

bash
desktopengine login [--api <url>]

Signs in to the DesktopEngine store: it shows a short code and opens the browser, where you confirm the code with your creator account. The token is kept in ~/.config/desktopengine/credentials.json (in $XDG_CONFIG_HOME when it's set), readable only by you. Publishing needs a creator account, which is by invitation for now, see Becoming a creator.

desktopengine logout [--api <url>] signs out and forgets the token.

publish ​

bash
desktopengine publish [folder] [options]

Packs the project like pack and uploads it as a new version of its item in the store. The first time, it claims the item for the id in manifest.json (the id must start with app.desktopengine.<your namespace>.) and fills the store listing from the manifest's name and description; edit the listing in the Creator Studio on the store afterwards. version must be higher than the published one; a version that is still a draft, or was rejected, is uploaded again.

The upload is checked right away (the same rules as validate, plus the store's: size, files, id and namespace). Problems are printed and the command exits with status 1. A submitted version is run on a review Mac and looked at by a reviewer before it's published, see Publishing.

OptionDescription
--notes <text>What's new in this version, in English, shown to reviewers and users
--notes-<locale> <text>What's new in another language, e.g. --notes-zh-Hans; the store shows the notes in the visitor's language, and the English ones where there are none in it
--network-purpose <text>What the network permission is for; needed to submit a version that has it
--copyright <origin>Where the content comes from: original, licensed or open; needed to submit the first time
--copyright-note <text>With licensed, who licensed it to you; with open, the license, e.g. CC BY 4.0
--submitSubmit the version for review after uploading it
--test-linkMake a link that installs this version in DesktopEngine before it's reviewed, marked as a test, for you and your testers
--debugThe test link's copy can be inspected in Safari's Web Inspector; only you can install it
--api <url>Another store API; also DESKTOPENGINE_API

In CI, set DESKTOPENGINE_TOKEN to the token login saved, instead of running login there.

The SDK is released under the Apache License 2.0