Get started
This page builds a working extension in a few minutes: a panel you toggle from the top bar or a shortcut. To have a coding agent do this for you, see Build with an agent.
1. Create the files
An extension is a folder with a package.json. Muxy loads the folder's dist/
build output when it has one, otherwise the folder itself, so a plain HTML page
needs no build step.
hello/
package.json
panel.html
package.json:
{
"name": "hello",
"version": "0.1.0",
"muxy": {
"description": "Says hello",
"permissions": ["panels:write", "notifications:write"],
"panels": [{ "id": "hello", "title": "Hello", "entry": "panel.html" }],
"commands": [
{
"id": "toggle",
"title": "Hello: Toggle Panel",
"action": { "kind": "togglePanel", "panel": "hello" },
"defaultShortcut": "ctrl+opt+h"
}
],
"topbarItems": [
{ "id": "hello", "icon": "sparkles", "command": "toggle", "tooltip": "Hello" }
]
}
}
panel.html:
<!doctype html>
<body style="background: var(--muxy-background); color: var(--muxy-foreground)">
<button id="hi">Say hello</button>
<script>
document.getElementById("hi").onclick = () =>
muxy.notifications.notify({ title: "Hello", body: "From my extension" });
</script>
</body>
The extension name should use lowercase letters, digits, ., and -. Its
pages don't load otherwise.
2. Load it
- Open Settings → Extensions and choose Load Unpacked….
- Pick the
hellofolder. - Open its entry and turn it on. Extensions start disabled.
- Click the sparkles icon in the top bar, or press
Ctrl+Opt+H.
The extension shows an Unpacked badge. After editing, choose Reload. Unload folder removes it from Muxy and keeps your files.
3. Use a build tool
For anything bigger, use any web tooling, such as Vite. Point every entry at
paths inside your build output, and copy package.json into dist/ as part of
the build. Only dist/ is published. For TypeScript, copy
types/muxy.d.ts into your source to type window.muxy.
"scripts": {
"build": "vite build && cp package.json dist/"
}
Debugging
muxy extension dev <folder>builds and reloads the extension each time you save, and prints whether it loaded with the log lines it added. See Developing and testing for opening its pages and driving them from the command line.console.log,console.warn, andconsole.errorfrom pages and scripts go to the extension's log, along with uncaught errors.- The extension's page in Settings → Extensions shows recent log lines, load errors, and Reveal log.
- The log file is
logs/output.loginside the extension's loaded folder.
Next
- Declare what it does in the manifest.
- Ask for the minimum permissions.
- Add tabs, panels, bar items, and commands.
- Work with files, Git, and events.
- Build with an agent.
- Publish it.
Coming from 1.x
Most 1.x extensions work unchanged. The differences:
- Install folder. Extensions live in Muxy 2's profile folder, not
~/.config/muxy/extensions. Importing the installed 1.x copies them over. - No scaffold. There is no starter kit. Use Load Unpacked…, or Create Extension… to build with an agent.
- Lowercase names. Pages only load for names made of
a-z,0-9,., and-. - Background scripts run in-process, in JavaScriptCore on their own thread.
- Not supported yet: remote methods for the phone app, home views, and the
worktree.offlineevent. - Bar items go where the extension declares them:
topbarItems,railItems, orstatusBarItems. 1.x's Show Extension Icon Rail let users move panel toggles to the rail; in 2.x the extension chooses withrailItems, and the 1.x preference imports as the rail's open state. See The rail. - New: the
openPanelcommand action,visibleon panel header buttons,execAsyncon pages and scripts, themodal.openedandmodal.closedevents, reading settings withmuxy.settings, and app controls:ui,commands,composer,layouts,preferences,clipboard, and moretabs,panes, andprojectscalls. See the API reference.