Building plugin packages
A plugin package is a .lkplugin file that adds content to LemmeKnow: themes, textures, fonts, sounds, Delivery Screens and notification cards. It's an ordinary zip archive with a manifest.json at its root. Packages carry content only. The only code a package can run is the JavaScript inside its Delivery Screens, which runs sealed off from the network and filesystem writes (see Delivery Screen pages).
Users install packages from Settings, Install Plugin Package, which is a Premium only feature. See Plugins on your phone for what the user sees.
The Backdrop package is a complete working example used throughout this page. Download it and unzip it to follow along.
Package layout
Put manifest.json at the top of the archive. Every other file can sit anywhere, at any depth, and is referred to by its path relative to the archive root. Backdrop looks like this:
backdrop.lkplugin
manifest.json
delivery/backdrop/screen.html
delivery/backdrop/texture.js
A package is refused at install if:
- it has no
manifest.json, or the manifest isn't a JSON object; - any entry's path contains
..or a backslash, starts with/, or would land outside the package; - it has more than 2,000 files, or unpacks to more than 100 MB;
- the manifest has no valid
id; - the manifest declares
webviewPage,execScript, oraction(those are for hub plugins only); contributeshas no entries at all.
Any declared file path that would resolve outside the package's folder is skipped.
manifest.json
{
"id": "example.sunrise",
"name": "Sunrise",
"label": "Sunrise pack",
"description": "Warm colors, a sun texture and a chime.",
"version": "1.2.0",
"contributes": {
"themes": [],
"textures": [],
"fonts": [],
"sounds": [],
"deliveryScreens": []
}
}
| Field | Required | Meaning |
|---|---|---|
id | Yes | The package's permanent identity. Letters, digits, _, . and - only. Installing a package with the same id replaces the installed one, so keep it stable across versions. |
name | No | Internal name. Defaults to id. |
label | No | The name users see in pickers and the review dialog. Defaults to name. |
description | No | Shown in the review dialog. |
version | No | A version string, shown in the review dialog. |
contributes | Yes | The content the package adds. At least one of the five lists must have an entry. |
The review dialog shows these as Id, Internal name, Name, Description, and Version.
Referring to your own files
Inside your package (for example, a theme that uses your own texture or font), refer to a contributed asset as:
plugin:import:<package id>:<asset id>
So a texture with "id": "sun" in the package example.sunrise is plugin:import:example.sunrise:sun.
Textures, fonts, and sounds
These three lists share one entry shape:
"textures": [
{ "id": "sun", "label": "Sun", "file": "textures/sun.png" },
{ "id": "sparkle", "label": "Sparkle", "file": "textures/sparkle.gif" }
],
"fonts": [
{ "id": "rounded", "label": "Rounded", "file": "fonts/rounded.ttf" }
],
"sounds": [
{ "id": "chime", "label": "Chime", "file": "sounds/chime.ogg" }
]
| Field | Required | Meaning |
|---|---|---|
id | Yes | Unique within its list. Used in plugin:import:... references. |
label | No | Name shown in pickers. Defaults to id. |
file | Yes | Path to the file inside the package. |
hash | No | Expected hash of the file, such as "sha256:<hex>". See Hashes below. |
Animated GIF textures are offered when the texture type is GIF, other images when it's Image. For where each kind shows up once installed, see What plugin content adds.
A Delivery Screen in the same package can also load these files directly as _plugin/<file> (see Delivery Screen pages).
Themes
A theme is written inline in the manifest, with no file of its own.
"themes": [
{
"id": "sunrise",
"name": "Sunrise",
"description": "Warm and bright",
"version": 1,
"paletteMode": "animated",
"paletteColors": ["#FF8A3D", "#FFC94D", "#FF5E7A"],
"waveMode": "wave",
"waveAngle": 0,
"colors": {
"ACCENT": "#FFFF8A3D",
"BG_APP": "#FF1A1210",
"BG_SURFACE": "#FF261A16",
"TEXT_PRIMARY": "#FFFFF4EC"
},
"styles": {
"screen": {
"textureType": "image",
"textureContent": "plugin:import:example.sunrise:sun",
"textureTileMode": "single",
"textureOpacity": 0.4
},
"card": { "cornerRadiusDp": 12, "borderWidthDp": 1 }
},
"fontFamily": "plugin:import:example.sunrise:rounded"
}
]
The easiest way to write a theme is to build it in the app and export it: on the Themes tab, the download icon on the current theme card saves it as a .lkplugin with its images bundled. Unzip that file and you have a correct manifest to start from.
| Field | Meaning |
|---|---|
id | Required. Unique within the package. |
name | Required. The theme's name in the list. |
description | Optional text on the theme card. |
version | Theme format version. Use 1. Defaults to 1. |
paletteMode | static (no animation), animated (animate paletteColors), or rgb (animate a full rainbow). Defaults to static. |
paletteColors | The palette as a list of #RRGGBB colors. |
waveMode | pulse, wave, ping_pong, breathe, or chaos. Leave it out to use Pulse. |
waveAngle | 0 to 359, the Wave and Ping-pong direction (0 is right, 90 is down). Leave it out to keep the user's angle. |
colors | Color overrides keyed by the app's color names (such as ACCENT, BG_APP, BG_SURFACE, TEXT_PRIMARY, TEXT_DIM, ALERT_ACCENT), as #RRGGBB or #AARRGGBB. Every color you leave out uses its default. |
styles | Element styles keyed by element (table below). Elements you leave out use their default style. |
windowLinked | false to style the top and bottom bars separately with windowTopStyle and windowBotStyle. Defaults to true. |
windowTopStyle, windowBotStyle | Element styles for each bar when unlinked. |
statusBarIcons, navBarIcons | light or dark system icons over the top and bottom bars. Default light. |
fontFamily | Empty for the system font, a family name such as serif or monospace, or a plugin: font reference. |
Element keys for styles:
| Key | Element in the Style tab |
|---|---|
monitor, dashboard, editor, screen | Monitor BG, Dashboard BG, Editor BG, Settings BG |
surface, inset | Surface, Inset |
window | Window Bars |
card, list_item, log, section | Card, List Item, Log Row, Section |
badge, chip, input | Badge, Chip, Input |
button, destructive, fab | Button, Destructive, FAB |
Element style fields (all optional; the default is shown):
| Field | Default | Meaning |
|---|---|---|
cornerRadiusDp | 0 | Corner radius |
borderWidthDp | 0 | Border width (strip height for window) |
borderColorKey | ACCENT_BORDER | Color name for the border |
elevationDp | 0 | Shadow |
fontSizeSp | 0 | Added to the normal text size |
fontBold | false | Bold text |
paddingDp | -1 | Added to the normal padding (-1 means none) |
textureType | none | none, text, image, or gif |
textureContent | Characters for text (use \n for multi-line tiles), or an image reference such as plugin:import:<id>:<texture id> | |
textureSizeDp | 0 | Tile or image size (0 is automatic) |
textureColorKey | ACCENT | A color name, or a fixed #RRGGBB |
textureColorMode | mask | mask, tint, or none for the image's own colors |
textureOpacity | 0.25 | 0 to 1 |
textureBackgroundColorKey | #000000 | Backdrop color behind the texture |
textureBackgroundOpacity | 0 | Backdrop opacity, 0 to 1 (0 is off) |
textureTileMode | grid | grid or single |
textureFitMode | none | none, horizontal or vertical |
textureAnchorHorz | center | left, center or right (single mode) |
textureAnchorVert | center | top, center or bottom (single mode) |
textureOffsetXDp, textureOffsetYDp | 0 | Offset from the anchor |
textureMarginHorzDp, textureMarginVertDp | 0 | Spacing between grid tiles |
texturePanDirDeg | 90 | Pan direction, 0 to 359 |
texturePanSpeedDpPerSec | 0 | Pan speed |
textureRotateSpeedDegPerSec | 0 | Tile rotation, -180 to 180 (negative is counter-clockwise) |
textureSingleLoopSec | 0 | Single mode loop length in seconds (0 is no loop) |
textureGradientSync | false | Move with the palette animation |
textureFlipH, textureFlipV | false | Mirror the texture |
Delivery Screens
A Delivery Screen is an HTML page the app shows full screen over the lock screen when a rule's Delivery step runs. How to write the page itself is covered in Delivery Screen pages. This is Backdrop's entry, shortened:
"deliveryScreens": [
{
"id": "backdrop",
"label": "Texture backdrop",
"entry": "delivery/backdrop/screen.html",
"assets": ["delivery/backdrop/texture.js"],
"includesSound": true,
"keepAwakeSeconds": 30,
"params": [
{ "key": "image", "label": "Background", "type": "image", "default": "theme:screen" },
{ "key": "showTitle", "label": "Show the rule name", "type": "toggle", "default": true }
]
}
]
| Field | Required | Meaning |
|---|---|---|
id | Yes | The screen's id, unique within the package. It also names the screen's address (see the pages reference). |
label | No | Name in the Delivery step's screen list. Defaults to id. |
entry | Yes | Path to the screen's HTML file. The folder holding it is the screen's root: the page can load files from that folder and below, and nothing above it. |
assets | No | Every other file the screen uses, as paths. Hub installs download exactly these, so list them all. |
includesSound | No | true if the screen plays audio (see Sound). Without it the Delivery step hides its volume and stream controls. Default false. |
keepAwakeSeconds | No | 0 to 30 (see Keeping the display on). Default 0. Above 0, the Delivery step shows a Keep the screen on switch, and the review dialog lists the time. |
params | No | Settings the Delivery step shows for this screen (below). |
hash | No | Expected hash of the entry file. |
Delivery Screen params
Each entry in params becomes an input in the Delivery step's settings, and the page reads the chosen values at run time (see params for what it receives). Backdrop declares nine; its full list is a good reference.
{
"key": "tileSize",
"label": "Grid size",
"type": "number",
"min": 16, "max": 256, "step": 8,
"default": 64,
"hardMin": 1,
"suffix": "dp",
"showIf": { "fit": "grid" }
}
| Field | Applies to | Meaning |
|---|---|---|
key | all | Required. A letter, then up to 39 letters, digits, or underscores. Unique within the screen. |
label | all | Input label. Defaults to key. |
type | all | Required. One of the types below. |
default | all | Value when the user hasn't set one, or has set an invalid one. |
showIf | all | Show the input only while earlier params have certain values (below). |
hint | text, tokens | Placeholder text in the field. |
multiline | text | true for a multi-line field. |
options | choice | Required. Strings, or { "value", "label", "showIf" } objects. |
min, max | number | The slider's ends. With both set (and max above min) the input is a slider, otherwise a number field. |
step | number | The slider's step size. |
hardMin, hardMax | number | Hard limits. Users can tap the slider value and type a number past min and max, but never past these. |
suffix | number | Up to 8 characters shown after the value, such as % or dp. |
Types:
| Type | Input | Default when none is given |
|---|---|---|
text | Text field | "" |
tokens | Text field with the Token Builder | "" |
number | A slider or number field | min, else 0 |
toggle | Checkbox | false |
choice | Dropdown | The first option |
color | Screen default, Theme color, or Custom | null |
image | Screen default, Theme style, or Image from System, File, or Plugin | null |
sound | System, File, or Plugin | null |
font | File or Plugin | null |
A number stays at or above 0 unless min or hardMin is negative.
Defaults for the special types:
- A
colordefault is#RRGGBB,#RRGGBBAA, ortheme:<COLOR_NAME>(for exampletheme:ACCENT). - An
imagedefault can betheme:<element>(for exampletheme:screen) to use that style's texture from the step's theme. - An
imagedefault can beasset:textures/<file>to use one of the app's built-in textures, the same ones offered under System when picking an image (for exampleasset:textures/lemme.png). - An
image,sound, orfontdefault can be a path inside the screen's folder (images/bg.png) or one of the package's own declared files (_plugin/sounds/chime.ogg).
Up to 32 params are read. An entry with a bad or repeated key, an unknown type, or a choice without options is skipped without an error, so check the Delivery step dialog after installing.
showIf
showIf maps the keys of params declared earlier to the values they must have. Every key must match. A value matches one value, any value in a list, or none of them with not:
"showIf": { "fit": "grid" }
"showIf": { "fit": ["grid", "fit"] }
"showIf": { "image": { "not": "none" } }
Keys that don't name an earlier param are ignored. What each type compares:
| Type | Matches against |
|---|---|
text, tokens, number, toggle, choice | The value itself |
image | none, theme (a theme style) or image (a picked file) |
sound, font | none or file |
color | none, theme, or custom |
A param left at its default matches as its default. A param is also hidden while any param its showIf names is hidden. Hiding an input doesn't change what the page receives (see params).
Choice options in object form can carry their own showIf. An option is offered only while its condition holds. If the selected option stops being offered, the choice moves to the default (when that is offered) or to the first offered option, both in the step dialog and when the alert fires.
Hashes
Any file entry, and a Delivery Screen's entry, may carry a hash such as "sha256:<lowercase hex>". The part before the colon names the algorithm; without one, SHA-256 is assumed. Hashes are checked whenever a plugin is installed, from a hub or from a file. A missing file or a mismatch stops the install before the review dialog appears.
Installing and updating
When a user opens your package, LemmeKnow checks the rules above and shows the review dialog (see Reviewing before you install). Play on a Delivery Screen runs it with a sample alert (see payload), so make sure your screen looks right with it.
To ship an update, change the files, bump version, and keep the same id. Installing replaces the old package completely, so include every file in each version. What the user sees when updating is described in Updating a plugin.
Hub plugins
A LemmeSee hub plugin can ship exactly the same contributes content alongside its own pages and scripts, installed from the hub with the same review dialog. See Installing on the phone in the hub guide.