Make plugins
A plugin is a small web page that Mirmire runs. There are two kinds:
- A widget plugin adds a widget to Mirmire’s Home page: a pet, a clock, a quote of the day, a game picker, anything you can draw in a small web page.
- A Big Picture plugin is a whole Big Picture of your own: it fills the screen, is driven by a controller, and is chosen in Settings › Layout › Big Picture style next to Mirmire’s own styles. See Make a Big Picture.
Plugins are ZIP files you import like a theme or an icon pack, so you can share them with anyone.
Widget plugins also run in Mirmire Dashboard, Mirmire’s Home page as an app of its own, without the games: see Plugins in Mirmire Dashboard.
The easiest way to make one is the Plugin mode of Theme Studio. Pick a template, edit the code, and see it live on a copy of the Home page (or, for a Big Picture, full screen with your keyboard as the controller), with sample games and achievements. Then press Download ZIP.
What’s in a plugin
my-plugin.zip
├── plugin.json what it is, its sizes and its permissions
├── index.html the widget (or the Big Picture) itself
└── ... any images, fonts, scripts or styles it uses
Put plugin.json at the top of the ZIP. A ZIP holding one folder with plugin.json inside works too.
plugin.json
{
"id": "pixel-pet",
"name": "Pixel Pal",
"author": "Your name",
"version": 1,
"description": "A little pixel creature that lives on your home page.",
"entry": "index.html",
"sizes": ["small", "wide", "medium"],
"defaultSize": "wide",
"permissions": []
}
| Field | Meaning |
|---|---|
id |
A unique name of lowercase letters, numbers and dashes. Importing a plugin with the same id replaces the old one. |
name |
Shown in the widget list. |
author, description |
Shown when someone installs it. |
version |
A whole number. Raise it when you share an update, so Mirmire offers it to players who installed the plugin from the catalog. |
entry |
The page to open. Usually index.html. |
sizes |
The sizes your widget can be: small (1×1), wide (2×1), medium (2×2), large (4×2), and tall (2 wide) and full (4 wide), which take every row of their page. See Tall and Full. |
defaultSize |
The size it starts at. One of sizes. |
permissions |
What else it may do: internet, library, achievements, ai and system. Leave it empty if it needs none. |
sounds, music |
Optional, for a Big Picture: menu sounds and background music of its own. See Sounds and music. |
kind |
Optional. "widget" (the default) or "bigpicture" for a Big Picture. A Big Picture has no sizes or defaultSize, and needs "api": 4. |
category |
Optional, for a widget: what it’s about in a word or two, such as "Emulators", "Play stats", "Clock and weather" or "Device". Settings › Plugins lists plugins under these headings; use one that’s already there if it fits. Without it, a widget is under Other widgets. A Big Picture is always under Big Picture. |
edgeToEdge |
Optional, for a Big Picture. true draws your page under a phone’s camera cutout and the system bars too, so its background reaches every edge. See Phones: the camera cutout and touch. |
icon |
Optional. A square picture of the plugin, shown beside its name in Settings › Plugins: a PNG, JPEG or WebP in the ZIP, 192×192 pixels is plenty. |
sites |
Optional. Websites the plugin may open full screen inside Mirmire with mirmire.openSite(), as host names: ["example.com"]. Needs the internet permission, and players see each one before they install. |
api |
Optional. The window.mirmire version the plugin needs. Leave it out unless you use something new: mirmire.openSite() needs 2; a Big Picture, mirmire.games.art(), get(), play() and mirmire.systems need 4; mirmire.system needs 5; mirmire.http() and mirmire.servers need 6; mirmire.socket() and selfSigned need 7; mirmire.games.video() and the "spine" and "back" artwork need 8. An older Mirmire then says the plugin needs a newer one. |
settings |
Optional. A page for the widget’s own options, such as choosing a pet. Players open it from Widget options in the widget’s edit menu. |
Tall and Full
The Home page is cut into pages of widgets, each as many rows tall as fit the screen: two on a short screen, three or more on a taller one. small to large are one or two rows. tall and full take every row their page has, so they fill it from top to bottom whatever the screen. On a two-row page they are exactly as tall as medium and large.
mirmire.rows says how many rows your widget got. Lay it out for any number from two up: let a list or a graph take the room (flex: 1), and show more of it when there’s more.
The quickest way to add both to a widget that already has medium and large is to draw them as those two, with the extra rows to fill. Every widget in the catalog starts with the same few lines, first thing in its <body>:
<script>
(function () {
var real = mirmire.size, rows = mirmire.rows || 2;
if (real !== "tall" && real !== "full") return;
mirmire.realSize = real;
mirmire.size = real === "tall" ? "medium" : "large";
document.documentElement.classList.add(real);
// Lengths written against the height (vh) stay what they are at the usual two rows.
if (rows > 2) document.querySelectorAll("style").forEach(function (s) {
s.textContent = s.textContent.replace(/(\d*\.?\d+)vh\b/g, function (m, n) { return +(n * 2 / rows).toFixed(3) + "vh"; });
});
})();
</script>
After it, the rest of your page sees medium or large, html.tall and html.full are there for your CSS, and mirmire.realSize keeps the size the player chose. An older Mirmire doesn’t know the two names and leaves them out of the sizes it offers, so listing them needs no api.
Permissions
Players see a plugin’s permissions before they install it, so ask only for what you use.
| Permission | Allows |
|---|---|
| (none) | Drawing itself, reacting to being selected, and keeping up to 64 KB of its own data. |
internet |
Loading images and data from the web. Without it, every request outside the plugin’s own files is blocked. With it, web requests go through Mirmire: they’re cached, so what the plugin loaded once also works offline, and any site can be read with fetch(), whatever its CORS settings. From API 6, mirmire.http() also sends POSTs, headers and logins to servers such as a RomM or Jellyfin on the player’s own network. See Servers and web services. |
library |
mirmire.games.recent(), all(), get(id), open(id) and play(id), each game’s artwork with mirmire.games.art(), and the consoles with mirmire.systems. A Big Picture can also mark favorites. |
achievements |
mirmire.achievements(): RetroAchievements points, rank, this week’s unlocks and the streak. |
ai |
mirmire.ai: short lines from an AI model the player sets up, about a game or their collection. See AI. |
romm |
mirmire.servers: the RomM libraries the player added in Settings › Library, read-only. Mirmire signs each request in; the plugin never sees the password or token. See Servers Mirmire is connected to. |
homeassistant |
mirmire.servers: the Home Assistant the player connected in Settings › Home Assistant, to read states and run actions. The plugin never sees the token. |
system |
mirmire.system.stats(): how busy the device is (processor, graphics, memory, storage, temperature and battery), and mirmire.system.tools() to open Settings › Tools. See The device. |
The window.mirmire API
Mirmire adds window.mirmire before your own scripts run.
mirmire.version // 8
mirmire.size // "small", "wide", "medium", "large", "tall" or "full"; "settings" on the options page; "bigpicture" for a Big Picture
mirmire.rows // the rows of the board the widget takes: 1, 2, or every row of its page for "tall" and "full"
mirmire.host // "mirmire", or "dashboard" in Mirmire Dashboard (see Plugins in Mirmire Dashboard)
mirmire.theme // { dark: true, colors: { primary: "#F5B54A", surface: "#1C1B22", ... } }
mirmire.storage.get("key") // a string, or null
mirmire.storage.set("key", "value") // pass null to remove it
// With the "library" permission:
mirmire.games.recent(5) // the last games played, newest first
mirmire.games.playing() // the game being played right now (launched from Mirmire), or null; on a handheld's second
// screen your widget stays visible while it runs
mirmire.games.all() // every visible game (up to 5,000)
mirmire.games.open(id) // opens that game's page
mirmire.games.get(id) // one game with its details (see below), or null
mirmire.games.play(id) // starts the game, as pressing A on it does; one that isn't on the device opens its page instead
mirmire.games.art(id, "box", 300)
// an address for the game's artwork, to use as an <img> src or a CSS background. Kinds: "box",
// "box3d", "screenshot", "title", "mix", "cart", "fanart" and "marquee" (its logo). The last
// argument is the largest side in pixels (48 to 1920; 480 when left out). Mirmire answers it
// from wherever the artwork is kept, so it needs no "internet" permission. Each kind but
// "marquee" falls back to another picture of the game; a game with none answers 404
// From API 8 also "spine" and "back": scans of the box's spine and back. Like "marquee" they have no
// stand-in, so most games answer 404; draw your own when the picture fails to load
mirmire.games.video(id) // an address for the game's video, to use as a <video> src (API 8). See below
mirmire.systems.all() // consoles that have games: [{ id: "snes", name: "Super Nintendo", games: 42, onDevice: 7 }]
mirmire.systems.icon("snes", 300) // an address for the console's icon, from the player's theme or icon pack
mirmire.bubble("Hi!", { ms: 3000, ai: false, x: 0.5 })
// a speech bubble Mirmire draws just above the widget, so it isn't cut off at the edges;
// x is where it points (0 = left, 1 = right), ai: true adds an "AI" tag
mirmire.openSettings() // opens the plugin's options page (needs "settings" in plugin.json)
mirmire.openPage("chat.html") // opens another of the plugin's own pages full screen, like its options page
mirmire.openSite("https://example.com/") // opens a website full screen inside Mirmire. Only https addresses on the hosts
// in "sites" (and their subdomains). The site is an ordinary web page: it gets no window.mirmire and
// none of your plugin's data. Links to other sites, and downloads, open in the device's browser.
mirmire.http(url, o) // with "internet": any web request, made by Mirmire. See Servers and web services
mirmire.socket(url, o) // with "internet": a web socket, opened by Mirmire (API 7). See Web sockets
mirmire.servers.list("romm") // with "romm" or "homeassistant": servers Mirmire is connected to
mirmire.servers.request(id, "/api/stats", o) // a request to one of them, signed in by Mirmire
mirmire.close() // on the options page: closes it
// With the "achievements" permission:
mirmire.achievements() // { user, points, rank, weekUnlocks, weekPoints, streakDays, mastered, beaten } or null
A game looks like this:
{ "id": 42, "title": "Concentration Room", "system": "nes", "systemName": "Nintendo Entertainment System",
"cover": "https://...", "favorite": false, "lastPlayed": 1731580000000, "playTimeMinutes": 95, "onDevice": true }
cover is a web address; showing it needs the internet permission too. mirmire.games.art(id) doesn’t, and also works for artwork kept on the player’s own storage, so prefer it.
From API 4, games in a list also have added (when the game joined the library), genre, rating (out of 5, to one decimal; 0 when unknown), year (the year it came out, 0 when unknown; from Mirmire 1.3.5, so check for it and fall back to released from games.get()) and status ("want_to_play", "playing", "completed", or empty). mirmire.games.get(id) adds what’s too long for a list: description, developer, publisher, released, players, playCount, and achievements and achievementsEarned (RetroAchievements).
From API 8, a game also says whether it has a video ("video": true), and mirmire.games.video(id) is its address. Like artwork, Mirmire answers it from wherever the video is kept (the web, the device’s storage or a NAS), so it needs no internet permission. A plugin that also runs on an older Mirmire checks that mirmire.games.video is there before using it.
<video muted loop autoplay playsinline></video>
<script>if (game.video && mirmire.games.video) document.querySelector("video").src = mirmire.games.video(game.id);</script>
- Play it muted. A page can’t start sound by itself, and Mirmire’s own music keeps playing behind your page.
- Most videos are MP4. A few libraries keep an animated GIF or WebP where the video goes; a
<video>can’t play those, so on itserrorevent show the same address in an<img>. - One at a time. Give
srcto the video the player is looking at, and take the element away when they move on.
The device
With the system permission (and "api": 5), a plugin can read how busy the device is, for a performance monitor.
mirmire.system.stats()
// { cpu: { usage: 37, speed: 54, cores: [{ mhz: 1400, maxMhz: 2800 }, ...] },
// gpu: { usage: 21 },
// ram: { used: 5300, total: 7600 }, megabytes
// disk: { used: 201000, total: 238000 }, megabytes, the device's own storage
// temp: { cpu: 48.3, gpu: 46.1, battery: 31.2, status: "normal" }, degrees Celsius
// battery: { level: 82, charging: true } }
mirmire.system.tools() // opens Settings › Tools: the same readings, closing background apps and clearing caches
- Some values are
null. Android only showscpu.usage,gpu.usage,temp.cpuandtemp.gputo apps with shell access, which the player sets up once in Mirmire (Settings › Tools explains how); some devices don’t report them at all.cpu.speed, the cores’ clock speed as a percent of their fastest, is usually there and is a fair stand-in forcpu.usage. A device with no battery hasbattery.level: null. temp.statusis how hot Android says the device is:"normal","warm","hot"or"critical"(nullbefore Android 10).- Ask every second or two, not faster. Mirmire takes a new reading at most every 0.7 seconds however often you ask, and the first
cpu.usagearrives with the second reading. Stop whiledocument.hiddenis true.
Vitals in the catalog is a complete example.
Servers and web services
With the internet permission (and "api": 6), mirmire.http() makes any web request: a POST to sign in, an Authorization or X-Api-Key header, a PUT or DELETE. Mirmire makes it itself, so it works whatever the server’s CORS settings and reaches a server on the player’s own network (http://192.168.1.20:8080). That’s what a dashboard widget for a home server needs: RomM, Jellyfin, Pi-hole, a download client.
const r = await mirmire.http("http://192.168.1.20:8080/api/stats", {
method: "GET", // or POST, PUT, PATCH, DELETE, HEAD
headers: { Authorization: "Bearer " + token },
body: { name: "Mirmire" }, // a string, or an object sent as JSON
timeout: 15, // seconds, 1 to 60
as: "text", // or "dataUrl" for a picture: a data: address for an <img>
selfSigned: true, // API 7: also accept the certificate a server made for itself (see below)
});
// { ok: true, status: 200, headers: { "content-type": "application/json" }, body: "…", json() }
if (r.ok) console.log(r.json().ROMS);
else console.log(r.status ? "The server said " + r.status : "Can't reach it: " + r.error);
- It always resolves. A server that can’t be reached gives
ok: false,status: 0and anerror. A server that answers with an error givesok: falsewith itsstatusandbody. - Pictures from an http server (most servers at home) won’t show in an
<img>: your page is https, and a web view won’t show an http picture on it. Fetch them withas: "dataUrl"and use the answer as thesrc. - Nothing is cached, unlike
fetch(). Keep what you need to show offline inmirmire.storage, and say when it’s from. - No cookies are kept between requests. Sign in for a token and send it in a header.
- Answers are up to 4 MB.
- A server Mirmire already knows needs no sign-in: see Servers Mirmire is connected to. For any other, ask the player for the server’s address, and sign in from the options page. Where the server can sign in a device with a code (RomM does), use that instead of asking for a password. Keep the token with
mirmire.storage, which stays on the device. - A server with its own certificate (most NAS boxes and routers at an
httpsaddress) is refused, as in any browser, unless you passselfSigned: true(API 7). Mirmire then remembers the certificate the first time your plugin reaches that address, and accepts only that one there from then on; a different one fails with anerror. Callmirmire.certificates.forget(address)when the player connects again from your options page, so a certificate the server made anew is taken as its own. A certificate the device already trusts passes as always. An older Mirmire ignores the option. - Send what you read only to the server it came from.
Web sockets
A page in a web view can’t open ws:// to a server on the player’s network, or wss:// to one with its own certificate. From API 7, mirmire.socket() can: Mirmire opens it.
const s = mirmire.socket("ws://192.168.1.30/api/current", { selfSigned: true });
s.onopen = () => s.send(JSON.stringify({ jsonrpc: "2.0", id: 1, method: "core.ping", params: [] }));
s.onmessage = (e) => console.log(JSON.parse(e.data));
s.onclose = (e) => console.log(e.error ? "Lost it: " + e.error : "Closed");
// s.readyState is 0 (opening), 1 (open), 2 (closing) or 3 (closed), as a browser's WebSocket; s.close() closes it
- Text only, up to 1 MB a message, and four sockets a page.
send()throws when the socket isn’t open. onclosealways comes, with anerrorwhen the socket failed or never opened (onerrorgets the same just before).- Mirmire closes it when your page goes. A widget off screen keeps its socket: close it yourself when
document.hiddenturns true, and open it again when it’s back. - Check for it:
if (mirmire.socket). On an older Mirmire fall back tonew WebSocket(), which reacheswss://addresses with a trusted certificate.
NAS in the catalog uses both: it talks to a TrueNAS over its web socket, at the certificate the TrueNAS made for itself.
RomM in the catalog is a complete example: it finds the server, signs in with a code, and shows the server’s numbers and latest games.
Servers Mirmire is connected to
A player who already added a RomM library in Settings › Library, or connected Home Assistant in Settings › Home Assistant, shouldn’t have to sign in again for a widget. With the romm or homeassistant permission (and "api": 6), a plugin can use those connections: it names the server and a path, and Mirmire sends the request with its own sign-in. The plugin never sees a password or token, and the request can’t go to any other address.
const servers = mirmire.servers.list("romm"); // or "homeassistant", or no argument for all the plugin may use
// [{ id: "romm:3", kind: "romm", name: "RomM", url: "http://192.168.1.20:8080" }]
if (servers.length) {
const r = await mirmire.servers.request(servers[0].id, "/api/stats");
if (r.ok) console.log(r.json().ROMS);
}
- The answer is the same as from
mirmire.http():ok,status,headers,body,json(), andas: "dataUrl"for a picture. - RomM is read-only: GET and HEAD. Home Assistant takes GET and POST, under its
/api/:/api/states/light.deskto read,/api/services/light/togglewith abodyto run an action. urlis for showing where the server is, and for pictures the server shows without signing in. Passidtorequest().- Offer your own sign-in as well, with
mirmire.http(), for players whose server isn’t connected to Mirmire. RomM does both: it uses the player’s RomM library when there is one, and signs in with a code when there isn’t.
AI
With the ai permission, a plugin can ask Mirmire’s AI for a short line about a game (a tip, a fun fact or a comment on
the collection) and, from a full-screen page, hold a chat the player types. The player sets the AI up once in
Settings › AI, and turns it on or off for each plugin on that plugin’s options page. It’s off until they turn it on.
- Where it runs (chosen in Settings › AI): Google Gemini, Groq or OpenRouter (free tiers, with the player’s own API key), any server with an OpenAI-style API (LM Studio or Ollama on a PC), or a model downloaded to the device (Qwen3 0.6B, 344 MB; Qwen3 1.7B, 977 MB; Gemma 4 E2B, 2.6 GB; Gemma 4 E4B, 3.7 GB).
- What’s sent: for hints, Mirmire writes the question itself from the game’s title and console, or a few titles from the collection; a plugin can’t add its own text. A chat sends what the player types and the last game’s title. File paths, accounts and keys are never sent.
- Keys: kept in Mirmire’s private storage on the device, never in backups or logs, and never shown to plugins.
- Where the player is: with the
achievementspermission too, hints about the game being played (and chat) include RetroAchievements’ live status for it, such as “World 3-2, 4 lives”, when the player is signed in to RetroAchievements and the game has one. Their RetroAchievements name is never sent. - Limits: hints, one every 4 minutes and 30 a day per plugin; chat, one message every 2 seconds and 150 a day.
test()doesn’t count.
// Any page:
mirmire.ai.status() // { enabled, ready, provider, providerLabel }: enabled = on for this plugin, ready = set up in Settings
mirmire.ai.ask("game", gameId, { name: "Mochi" }).then((r) => { if (r.ok) say(r.text); }) // r = { ok, text } or { ok: false, error }
// kinds: "game" (just played), "playing" (being played now), "collection" (a few of the player's games)
// name: what the AI calls itself (letters, digits and spaces, up to 20); "Mirmire" when empty
mirmire.ai.settings() // opens Settings › AI
// Only on a full-screen page (the options page, or one opened with openPage):
mirmire.ai.configure({ enabled: true }) // this plugin's switch; returns the new status
mirmire.ai.test({ name: "Mochi" }) // a Promise like ask(); shows whether the setup works
mirmire.ai.chat([{ role: "user", text: "Any tips for Contra?" }], { name: "Mochi" })
// a conversation the player types: the last 12 messages ("user" or "assistant"),
// each up to 500 characters; the most recently played game is mentioned to the AI.
// Resolves to { ok, text } or { ok: false, error }
Hint replies are a single line of plain text, at most about 160 characters; chat replies are up to a few sentences.
When the AI isn’t set up, the quota is used up or the device is offline, ask() returns { ok: false }. Fall back to your
own lines quietly, and mark AI lines so players can tell them apart (Pixel Pal adds an AI tag to its speech bubble).
Events
// The player pressed A (or tapped) on your widget.
window.addEventListener("mirmire:select", () => feed());
// The player switched themes. mirmire.theme has the new colors.
window.addEventListener("mirmire:theme", () => redraw());
// The library changed: new games, a favorite, a finished download, a game just played. Ask for the lists again.
// Sent to a Big Picture.
window.addEventListener("mirmire:library", () => reload());
Theme colors
The theme’s colors are set as CSS variables on the page, so your widget matches every theme without extra work:
.title { color: var(--primary); }
.card { background: var(--surface-variant); color: var(--on-surface); border-color: var(--outline); }
The variables are --primary, --on-primary, --secondary, --tertiary, --background, --on-background, --surface, --on-surface, --surface-variant, --on-surface-variant, --outline and --error.
Three more are the same in every theme, because they mean something: --favorite (the pink-red of a favorite’s heart), --gold (ratings and trophies) and --success (it worked, or it’s on the device). They’re there from Mirmire 1.3.5, so give a fallback: fill: var(--favorite, #FF6B8A), var(--gold, #FFC23D), var(--success, #4FD18B). Prefer a small picture to words for this kind of fact (a heart, a star, a cloud with a tick or an arrow): the catalog’s Big Pictures show how.
The page background is transparent: Mirmire draws the card behind your widget, with the theme’s shape, and the focus outline around it.
An options page
Add "settings": "settings.html" to plugin.json and a settings.html next to index.html. It opens full screen, with the same window.mirmire and the same storage as the widget, so save choices with mirmire.storage.set(). When it closes, the widget reloads to pick them up. On a controller, the arrow keys reach the page as keydown events and A clicks the focused element, so use real buttons and inputs and move focus with the arrows. B closes the page.
Theme Studio previews the widget page only; add an options page (or other pages you open with mirmire.openPage) to the ZIP by hand. In the preview, mirmire.ai gives sample answers, mirmire.bubble shows along the top, and mirmire.games.playing() returns the first sample game.
Make a Big Picture
A Big Picture plugin replaces the whole of Big Picture with your page: your layout, your motion, your idea of what a library should look like. (Need a 3D engine or native speed instead of a web page? A separate app can be a Big Picture too: see Make a Big Picture app.) Players install it like any plugin and pick it in Settings › Layout › Big Picture style. Game Wall, Crossbar, Ledger and Timeline in the catalog are complete ones, each a single readable file, and each a different idea of what a library can look like. Shelves is a larger one: boxes in CSS 3D, console models drawn with three.js, and a game’s video. Theme Studio’s New Big Picture starts from Game Wall, and the others are among its templates.
{
"id": "game-wall",
"name": "Game Wall",
"author": "Your name",
"version": 1,
"description": "A Big Picture that is one wall of covers.",
"kind": "bigpicture",
"entry": "index.html",
"permissions": ["library"],
"api": 4
}
Your page fills the screen, inside the camera cutout and system bars. The page background is transparent, so the player’s theme wallpaper shows wherever you paint nothing; paint html or body to cover it. Theme colors arrive as the same CSS variables a widget gets.
The controller
Presses arrive as mirmire:button events. There is no mouse and no browser focus to rely on: keep track of what’s selected yourself, and draw it.
window.addEventListener("mirmire:button", (e) => {
const { button, repeat } = e.detail; // repeat is true while a direction is held
if (button === "right") move(+1);
else if (button === "a") mirmire.games.play(selected.id);
else if (button === "b") { if (!goBack()) return; } // nowhere to go back to: leave B alone
else return;
e.preventDefault(); // you used the press
});
button |
Comes from |
|---|---|
up, down, left, right |
The D-pad, the left stick, or a keyboard’s arrows. Held, they repeat with repeat: true. |
a |
A, Enter, or OK on a remote. |
b |
B, Esc, or Android’s Back. |
x, y, l1, r1, l2, r2, select |
Those buttons. |
Players who swapped A and B, or remapped a button, get what they chose: you always see the button’s meaning. Touch works as on any web page, so make covers and tabs tappable too.
Mirmire keeps a way out that your page can’t take away:
- Start always opens Mirmire’s own menu: volume, sounds, controllers, switching player, All settings, Use Mirmire’s Big Picture and Exit Big Picture. Your page never sees Start.
- B opens that menu when you don’t call
preventDefault()on it. Take B while you have somewhere to go back to, and leave it alone on your first screen. Three quick presses of B always open it. - L3 (a press of the left stick) opens Mirmire’s quick menu, as on every screen.
- By touch, Mirmire draws a small Menu button of its own in the top right corner when Big Picture opens and for a few seconds after each touch. It opens the same menu. Keep that corner free of anything a player needs to tap, and consider a menu button of your own that calls
mirmire.bigPicture.menu(), as Game Wall has.
What a Big Picture can do
mirmire.bigPicture.menu() // opens Mirmire's menu (the one on Start), for a button of your own
mirmire.bigPicture.settings() // opens Mirmire's Settings (asks for the parent's PIN when they're locked)
mirmire.bigPicture.search() // opens the quick menu's search
mirmire.bigPicture.exit() // leaves Big Picture, back to the home screen
mirmire.bigPicture.select(id) // tells Mirmire which game the player is on (null for none), so a handheld's
// second screen shows it
// With the "library" permission, as well as everything a widget gets:
mirmire.games.favorite(id, true) // marks a game as a favorite, or not (false)
mirmire.openSettings(), openPage() and openSite() work as in a widget, and open over your Big Picture. mirmire.bubble() does nothing here: draw your own.
What you list is what Mirmire’s own Big Picture would: games hidden by library cleanup or by a child’s profile aren’t in mirmire.games.all().
Sounds and music
A Big Picture gets the player’s theme sounds and music without doing anything: Mirmire plays a sound for each press and the theme’s music behind your page. To give yours its own, add the files to the ZIP and name them in plugin.json:
"sounds": { "move": "sounds/move.wav", "select": "sounds/select.wav", "back": "sounds/back.wav" },
"music": ["music/drift.ogg"]
| Sound | Plays when |
|---|---|
move |
The D-pad or left stick is pressed |
select |
A, X, Y or Select |
back |
B |
tab |
L1, R1, L2 or R2 |
menu |
Start, when Mirmire’s menu opens |
favorite |
A game is marked a favorite |
launch |
A game starts |
edge |
A press that nothing used, which is rare in a Big Picture |
- Anything you leave out stays the theme’s. Supply only
moveandselectand the rest of the sounds, and the music, are the player’s theme’s. With nomusic, the theme’s music plays. - Mirmire plays them, so they follow the player’s Menu sounds and Background music switches and volumes, and stop when a game starts. Your page doesn’t play audio itself.
- Files are WAV, OGG or MP3, inside the ZIP. Keep menu sounds short (under a second) and as WAV or OGG. Music tracks play in order and repeat; one track that loops cleanly is enough. Up to 8 tracks.
- They play only while your Big Picture is on screen. On a game’s page or in Settings, the theme’s are back.
- Theme Studio doesn’t add these fields: put the files in the ZIP and the two fields in
plugin.jsonby hand, as with an options page.
Phones: the camera cutout and touch
On a phone, Big Picture is played by touch, and in landscape the camera cutout sits at one side of the screen.
- By default, Mirmire keeps your whole page clear of the cutout and the system bars, leaving the same room on the right as the cutout takes on the left (or the other way round), so your page stays centred. The strips beside it show the theme’s wallpaper.
- With
"edgeToEdge": true, your page fills the whole screen, and Mirmire tells it which edges to keep text and buttons clear of. The sizes are in CSS pixels, as the variables--safe-top,--safe-right,--safe-bottomand--safe-left, and asmirmire.safeArea({ top, right, bottom, left }). They change when the phone turns, with amirmire:safeareaevent. Paint your background everywhere, and place everything else inside them:left: calc(2em + var(--safe-left, 0px)). To keep things centred, as Crossbar does, use the larger ofleftandrighton both sides; Mirmire’s Menu button does the same. All four are0on a device with no cutout, and on an older Mirmire, which keeps your page clear of the cutout itself. - Make it work with a finger. Taps arrive as ordinary clicks and pointer events. Give
htmlandbodytouch-action: noneif you handle drags yourself, so they don’t scroll the page. Crossbar is an example: drag along the bar or the column to move, tap to play and hold for a game’s page. - Keep the top right corner free. Mirmire’s Menu button appears there, inside the safe edges, after a touch (see The controller).
Good to know
- Your page starts again when the player comes back from a game’s page or from Settings (not from a game itself). Save where they were with
mirmire.storage.set()as they move, and go back there when you load. - Draw only what’s on screen. A library can have thousands of games; a page with thousands of
<img>elements crawls on a handheld. Game Wall keeps elements only for the rows in view. - Ask for artwork at the size you draw it,
mirmire.games.art(id, "box", 300), not full size. - Size from the page, not the window. Give
htmlandbodyheight: 100%and lay out inside the body. Don’t useposition: fixed, orwindow.innerWidthandinnerHeight: in Mirmire they can describe an area larger than the screen, which puts things off its right and bottom edges. In scripts, usedocument.documentElement.clientWidthandclientHeight. - Scrolling areas can show the browser’s focus outline. Add
outline: noneto them. - A text field brings up the on-screen keyboard; while it has focus, the D-pad and A go to the field instead of your
mirmire:buttonhandler. B closes the keyboard first. - Attract mode (videos while Big Picture is left idle) belongs to Mirmire’s own styles and doesn’t run over a plugin.
- Test on a real device. Theme Studio previews the layout and the buttons (arrows, Enter = A, Esc = B, X, Y, Q and E = L1 and R1, 1 and 3 = L2 and R2, Tab = Select, M = Start) with sample games; speed on a handheld is something only the handheld can tell you. In a debug build of Mirmire, the page shows up in
chrome://inspect, andconsole.loggoes to logcat underMirmirePlugin.
Tips
- Size with the page, not with pixels. The widget fills its card. Use
vh,vw, percentages or flexbox, and check every size you list in Theme Studio. - Keep it light. Several widgets can be on screen at once, often on a handheld. Avoid heavy animation loops; pause them when
document.hiddenis true. - Don’t expect a mouse. Players select your widget with a controller. React to
mirmire:selectrather than to clicks on small buttons. - No links. Navigation away from the plugin’s page is blocked. Use
mirmire.games.open(id)to open a game, andmirmire.openSite()to show a website named insites. - Store little.
mirmire.storageholds up to 64 KB per plugin, and stays on the device. - Only share what you’re allowed to. Credit art, fonts and sounds in
authoror a README in the ZIP.
Plugins in Mirmire Dashboard
Mirmire Dashboard is Mirmire’s Home page on its own: a light dashboard and home screen for a homelab, a wall tablet or a TV box, with no game library. It installs widget plugins from the same catalog and runs them the same way: the same sizes (including Tall and Full), mirmire.rows, theme colors, options pages, mirmire.openSite(), mirmire.http(), mirmire.socket() and selfSigned.
What it can’t do is anything about games, so only some permissions work there:
| Permission | In Mirmire Dashboard |
|---|---|
internet |
Works as in Mirmire. |
system |
Works. Graphics load and some temperatures are null (Mirmire reads them through its own shell access), and mirmire.system.tools() opens Android’s storage settings. |
homeassistant |
Works, with the Home Assistant connected in the Dashboard’s Settings › Home Assistant. |
library, achievements, ai, emulators, romm |
Not available. A plugin that asks for any of them is listed under Only in Mirmire in the Dashboard’s catalog and can’t be installed there. |
Big Picture plugins are Mirmire only.
To check where it’s running, read mirmire.host: "dashboard" in Mirmire Dashboard, "mirmire" in Mirmire (versions before 1.3.9 leave it out). In the Dashboard, mirmire.games, mirmire.systems, mirmire.achievements() and mirmire.emulators still exist and answer empty, and mirmire.ai answers with an error, so a plugin shared by both apps doesn’t fail on them.
To make a widget that works in both, ask only for internet, system or homeassistant. Every Home server plugin in the catalog except RomM does.
Share your plugin in Mirmire’s catalog
Mirmire lists the plugins from mirmire-plugins under Settings › Plugins › Available plugins, where players install them with one press. To add yours, fork that repository, put your plugin’s folder in plugins/, and open a pull request. Its README has the steps and what a pull request needs.
Install a plugin
- Settings › Plugins › Available plugins: pick one from the catalog and press Install, or
- Settings › Plugins › Add a plugin for a ZIP, or
- on the Home page, Edit › Add widget › Plugins › Import a plugin ZIP.
Mirmire shows the plugin’s name, author and permissions, and installs it when you press Install. Then add a widget from Add widget › Plugins, or choose a Big Picture in Settings › Layout › Big Picture style and turn on Big Picture. To turn a plugin off or remove it, open Settings › Plugins; a Big Picture that’s off or removed gives way to Mirmire’s own.
Troubleshooting
| Problem | Fix |
|---|---|
| “No plugin.json in that ZIP” | Zip the plugin folder’s contents, so plugin.json is at the top. |
| The widget is blank | Check that entry names your page, and that sizes use vh/% rather than a fixed height. On a computer, Theme Studio’s preview shows script errors as a message. |
| An image or font doesn’t load | Paths are relative to the ZIP’s top, for example img/cat.png. Web addresses need the internet permission. |
mirmire.games returns nothing |
Add library to permissions, then import the plugin again. |
| The old version still shows | Use the same id to replace a plugin. |
| A Big Picture shows up as a widget, or “needs a newer Mirmire” | Add "kind": "bigpicture" and "api": 4. Big Picture plugins need a Mirmire that offers plugin API 4. |
| The D-pad does nothing in a Big Picture | Listen for mirmire:button on window, not for keydown. |
| Stuck in a Big Picture | Press Start, or touch the screen and tap Menu in the top right corner (or press B or Back three times quickly), then Use Mirmire’s Big Picture or Exit Big Picture. |