Getting Started
The DesktopEngine app only provides the core services: it runs mini programs, manages the library and playlists, and assigns displays. Dynamic wallpapers, widgets and desktop companions are made by developers and creators with this SDK and published to the DesktopEngine store, where users install them into the app.
The SDK includes:
- The
desktopenginecommand line tool: create, run and debug, build, validate and pack projects, and publish them to the store - Project templates for wallpapers, widgets and desktop companions, plus WebGL, three.js and PixiJS versions for wallpapers
- Type declarations of the runtime API, which editors use for completion and type checking (see the API reference)
- A JSON Schema for
manifest.json
Install
You need Node.js 18 or later, and a Mac with DesktopEngine installed.
npm install -g @desktopengine/sdk
desktopengine --versionTo skip the global install, run npx @desktopengine/sdk <command> instead.
Recent versions of npm warn that esbuild's install script (postinstall) didn't run. You can ignore it: the SDK doesn't need it.
Create and run
desktopengine create widget ~/Projects/day-progress --id com.example.day-progress --name "Day Progress"
desktopengine dev ~/Projects/day-progressThe type given to create is wallpaper, widget or companion (a desktop companion: a character, mascot or anything else that moves around the screen above windows). See Projects and Builds for what the project contains.
dev opens DesktopEngine and runs the mini program in it:
The first time it connects, the app asks whether to allow it (and first whether to turn on the Develop menu, if it's off).
Saving a file rebuilds and reloads it; the position its window was dragged to is kept across reloads.
console.logand the other console output, uncaught exceptions (with their stack), rejected promises nobody handles andpostMessage('host', …)are printed in the terminal. The Mac App Store version of DesktopEngine doesn't see the rejection of an async function's promise that nothing awaits or catches, e.g.main();at the end of the script: writemain().catch(console.error);.Options stand in for what the user picks in the details pane, and
DesktopEngine.launchOptionsis exactly what it is once installed:bashdesktopengine dev . --size medium --level floating --display 2 --param accent=#FF9F0A --param workday=trueWith
--perf, the last line of the terminal shows the frame rate, CPU, wake-ups and memory every second, see Performance.Press Ctrl-C to stop; the mini program is removed from the desktop too.
Debugging with breakpoints
In Safari, turn on "Show features for web developers" in Settings › Advanced, then choose Develop › this Mac › the mini program. Only mini programs loaded after DesktopEngine's Develop menu is turned on can be inspected. Development builds of src/ projects have source maps, so the inspector shows your original files.
You can also do without dev: run desktopengine build, turn on Settings › Advanced › Show Develop Menu in Menu Bar, choose Develop › Load Local Mini Program… (⌘⌥O) and pick the project's dist/package/ folder. It reloads after each build. This way DesktopEngine.launchOptions is an empty object {} (the templates have defaults for everything).
Validate, pack and import
desktopengine validate ~/Projects/day-progress
desktopengine pack ~/Projects/day-progresspack writes <id>-<version>.zip into the project's dist/. To import it, click the import button in the toolbar of All Wallpapers, Widgets or Companions in DesktopEngine, or choose File › Import…. Import what pack makes: the app takes a folder too, but as it is, so a project folder would bring its other files along (.env, node_modules…) and a symbolic link in it is refused. What you import shows up by type: wallpapers in the wallpaper grid (filter the toolbar by Dynamic), widgets and companions on their own pages. Importing the same id again replaces the old version, and instances running on the desktop restart with the new one.
Publish
Importing is how you try a package before anyone else gets it. To share it, publish it to the store:
desktopengine login
desktopengine publish ~/Projects/day-progress --test-link
desktopengine publish ~/Projects/day-progress --submit --copyright originallogin signs in with your creator account. publish --test-link uploads the version and prints a link that installs it in DesktopEngine, so you can test it the way users will get it. publish --submit then submits it for review; it's published once it's approved, and installed copies update themselves. Publishing is by invitation for now (ask for one at creators@desktopengine.app), and your content's id must start with your namespace: see Publishing.
Next
- Projects and Builds: what's in a project and how
src/is bundled - Manifest: name, type, permissions and the options users can change
- Wallpapers, or Launch Options and Windows for widgets and desktop companions
- Design Guidelines: how content fits in with macOS
- Publishing: the store's review, age ratings and updates
