LedgeKit is the Swift package Ledge add-ons are written with. An add-on gives Ledge a new ability without a new version of Ledge, and reaches people through the Add-on Store.
Where an add-on shows up
An add-on describes what it wants to show, and Ledge draws it in its own style, in the places below. The add-on never draws on screen itself, so everything looks like Ledge and stays where Ledge puts it.
How an add-on works
An add-on is a folder ending in .ledgeaddon: a manifest, addon.json, that says who made it, what it shows and what it needs; an icon; and a native program built with LedgeKit.
While it's turned on, Ledge keeps the program running and talks to it over a session, one line of JSON at a time. The add-on sends what to show; Ledge sends back what the user did, and asks it questions, such as whether the playing song is in your Liked Songs. When the add-on needs something only Ledge has, like your Spotify sign-in, it asks Ledge, and Ledge does it without handing over the credentials.
The three pieces
| What it is | Where | |
|---|---|---|
| Add-on Store | The page in Ledge's Settings that lists published add-ons, installs and updates them | Settings → Add-on Store |
| LedgeKit | The Swift package add-ons are written with, and the ledgekit command | Ammyy9908/LedgeKit |
| LedgeAddOns | The public repository of add-on source. Developers open pull requests here; merged add-ons are built and listed in the Store | Ammyy9908/LedgeAddOns |
In the Store today
| Add-on | What it does | Uses |
|---|---|---|
| Spotify Likes | The heart in Ledge's players likes or unlikes the playing Spotify song | A player button, a settings page with Ledge's Spotify sign-in |
| Apple Music Controls | Favourite, Add to Playlist and Music's own Playing Next | A player button, a ••• menu entry, Playing Next, a settings page |
| Notifications | Mirrors visible macOS notification banners in the notch | A settings page; Ledge reads the banners and passes their text |
LedgeKit's repository also has an example, Timer, that uses every place in the figure above. The quick start builds a smaller version of it.
Where things stand
LedgeKit is a developer preview at version 0.13.0. Today:
- The Store installs, updates and removes any published add-on, and checks each file against the catalogue first.
- You can load a
.ledgeaddonyou built yourself from your Mac. - Add-ons can show everything in the figure above, keep their own settings and use accounts Ledge manages.
- Building a package is still done by hand.
ledgekit new,buildandrunare next.