wingmirror Download
Docs Building from source

Docs · Going further

Building from source

Needs a Swift 5.10 or later toolchain (Xcode 15.3 or later, or its command line tools) on Apple Silicon. There are no third-party dependencies.

git clone https://github.com/ecomlabsio/wingmirror.git
cd wingmirror
swift build
swift test

To build the app and open it:

tools/make-app.sh          # builds ~/Applications/Wingmirror.app
open ~/Applications/Wingmirror.app

tools/make-app.sh --restart quits a running copy first and opens the new one; without it a running copy is left alone and the script says so. A different folder can be given as the last argument.

A build made this way is signed ad hoc. macOS ties Input Monitoring to the signature and an ad hoc one is different for every build, so the permission has to be allowed again after each rebuild (see Permissions it asks for). Set WINGMIRROR_SIGN_IDENTITY to a Developer ID to sign with that instead.

To stop that on a Mac you build on often, run tools/make-dev-identity.sh once. It puts a signing identity called "Wingmirror Development" in your login keychain, a certificate that vouches only for itself, and tools/make-app.sh signs with it from then on. The first build asks once whether codesign may use the key (choose Always Allow), Input Monitoring is allowed one last time, and later builds keep it. The identity means nothing to another Mac: a build for anyone else needs a Developer ID. Delete it in Keychain Access to go back to ad hoc builds.

.github/workflows/checks.yml builds and tests the package on a Mac runner, and fails on any compiler warning. It runs only when started by hand, because a private repository's Mac minutes are counted tenfold; once the repository is public it can be set to run for every pull request. Its first runs failed in PanelTests while the same tests passed locally: the runner's older Swift lays the resource bundle out differently, and the panel's web app and widgets were looked for where only the newer layout has them. They are now found in both.

Port 7317 is the live one

The app listens on 127.0.0.1:7317. Once Claude Code is connected, that port receives real permission requests from every open session, and a click on Approve there approves a real command. Develop on a spare port, with made-up sessions:

WINGMIRROR_PORT=7399 swift run Wingmirror    # always in a window, so it cannot cover the real panel
tools/demo-sessions.sh attention             # also: calm, one, many, eight, twelve

tools/demo-sessions.sh talks to port 7399 unless WINGMIRROR_PORT says otherwise, and refuses 7317.

A run on a spare port keeps to itself: its layout is not saved, its tally is kept in memory, it reads no transcripts, it has no logo and no actions, the System and Git widgets stay empty, and it leaves the real panel's backlight and touch alone. It does load your own widgets. Without WINGMIRROR_PORT a run is the live instance, and it will not start while the installed app has the port.

Other ways to run it:

WINGMIRROR_PORT=7399 swift run Wingmirror --headless   # no panel, only the server
tools/fake-agent.sh allow     # replays a recorded Claude Code session; also deny, timeout, keyboard

--window keeps the live instance in a window even with the Edge attached, whatever is chosen under Panel On. A spare-port run is always in a window and offers no choice of display.

--view-size 1920x1080, with --snapshot, draws the picture as a view of that size holds the panel, to check where it sits on a display of another shape. --inject-tap is then measured from that view's top left.

tools/fake-agent.sh answers its own request, which only the panel may do when there is one, so it needs a --headless run.

To drive a windowed run from a script, choose its secret with WINGMIRROR_PANEL_TOKEN=dev and send it as the header X-Wingmirror-Panel: dev. Port 7317 never takes a secret from outside.

Pictures and checks without a screen

--snapshot draws the panel off screen in the same web view the app uses, prints a line for each widget (its size, whether anything overflows, any button on show under 64 × 64 pixels as the widget is drawn, whether the panel's three faces are loaded there), writes a picture and quits. The sessions have to arrive in the few seconds before it does:

swift build
WINGMIRROR_PORT=7399 .build/debug/Wingmirror --snapshot /tmp/panel.png &
until curl -sf -o /dev/null http://127.0.0.1:7399/api/health; do sleep 0.1; done
tools/demo-sessions.sh attention
wait
FlagWhat it does
--page <n>Shows page n of the layout, counting from 0
--eval '<javascript>'Runs a line in the panel's page first, for example wingmirror.editLayout() to open the settings area or wingmirror.showAmbient(true) for the ambient page
--inject-tap <x>,<y>Taps a point, measured from the panel's top left, the way a touch is delivered. Can be given more than once.
--inject-drag <x1>,<y1>,<x2>,<y2>Holds a finger at the first point, drags it to the second and lifts, the way a touch is delivered. Can be given more than once.
--inject-lostThe injected touches are lost instead of lifted, as when the controller is unplugged under a finger
--tap-approvePresses the first Approve button
--gate-checkHas every widget try an action and a topic it may not have, and prints what happened
--setup-snapshot <png>Draws the setup window as it would look on this Mac, and quits

The pictures of the panel in this README are drawn the same way, by one script:

tools/make-pictures.sh

It redraws every picture in docs/images, at the sizes they are kept at, from made-up sessions and files it writes to a temporary folder. The setup window is not drawn as it is on this Mac, which would show what is installed here, but from the made-up first run the tests keep, so that one picture runs a test. It uses port 7466 unless WINGMIRROR_PORT says otherwise and refuses 7317. Run it after a change to how the panel looks, and give it a folder to draw into (tools/make-pictures.sh /tmp/pictures) to see the result before replacing the ones here.

Environment variables

VariableEffect
WINGMIRROR_PORTThe port to listen on. Anything but 7317 is a spare-port run.
WINGMIRROR_PANEL_TOKENThe panel's secret, on a spare port only
WINGMIRROR_REAL_DISPLAY=1Lets a spare-port run use the Edge and its backlight
WINGMIRROR_NO_EDGE=1Makes a spare-port run behave as a Mac with no Edge: its brightness and blanking do not answer
WINGMIRROR_WIDGETS_DIRA folder of widgets to use in place of the one in Application Support
WINGMIRROR_TRANSCRIPTSA folder of transcripts to read token totals from, on a spare port
WINGMIRROR_LOGO_DIRA folder holding a logo, on a spare port
WINGMIRROR_AGENT_ICONS_DIRA folder holding your own pictures for agents, on a spare port
WINGMIRROR_ACTIONS_DIRA folder holding an actions.json, on a spare port
WINGMIRROR_DEMO_DATA=1Made-up figures for the System and Git widgets, on a spare port
WINGMIRROR_TALLY_FILEA file to keep the Figures widget's tally in, on a spare port, which otherwise keeps it in memory
WINGMIRROR_SESSIONS_FILEA file to keep the list of sessions in across a restart, on a spare port, which otherwise keeps none
WINGMIRROR_RISKY_FILEA file of your own risky words and phrases, on a spare port
WINGMIRROR_DESKTOP_SESSIONS_DIRA folder laid out as the Claude desktop app's record of its Claude Code sessions, on a spare port, which otherwise reads none
WINGMIRROR_TEST_PICTURESFor swift test: a folder for the pictures two tests draw for looking at, the menu bar marks and the setup window in states that need a person at the panel. Without it they draw nothing.
WINGMIRROR_DIAGNOSTICS=1Records diagnostics for this run whatever the menu's switch says; 0 keeps them off
WINGMIRROR_LOG_FILEA file to write the log to as well as the terminal, on a spare port
WINGMIRROR_HOLD_SECONDSHow long a permission request is held
WINGMIRROR_CAPTURE_DIRSaves every hook request, headers included, as a JSON file, for making fixtures
WINGMIRROR_SETTINGS, WINGMIRROR_CODEX_HOOKS, WINGMIRROR_CODEX_CONFIG, WINGMIRROR_COPILOT_HOOKS, WINGMIRROR_CURSOR_HOOKS, WINGMIRROR_SUPPORT_DIRFor hooks install and uninstall: a Claude Code settings file, a Codex hooks file, a Codex config, a GitHub Copilot hooks file (in a hooks folder inside a folder that exists), a Cursor hooks file (inside a folder that exists) and a scripts folder other than the real ones. WINGMIRROR_CURSOR_HOOKS is also followed by the app itself, so a spare-port run can be kept off the real file.
WINGMIRROR_AGENTFor Wingmirror mcp: the name the agent has on the panel, in place of the client's own

The command line

Wingmirror hooks install | uninstall | status       Claude Code
Wingmirror hooks install codex | uninstall codex    Codex
Wingmirror hooks install copilot | uninstall copilot    GitHub Copilot
Wingmirror hooks install cursor | uninstall cursor      Cursor
Wingmirror widget new <id> [name]
Wingmirror widget validate <folder>
Wingmirror widget pack <folder>
Wingmirror mcp                                       the MCP server, on standard input and output
Wingmirror diagnostics report <log file>             the diagnostics report made from a log file

hooks install codex adds the hooks and the notify entry; Codex still has to be told to trust the hooks. The four scripts the connections install read WINGMIRROR_PORT as well, and post to 7317 without it.

Tests

swift test covers the server's contract, the panel rules, the daily tally, the token scanner, the four installers, screen placement, the widget kit, the display driver against a stand-in panel, terminal selection, the touch parser, and the diagnostics: what is said of a touch, what the panel may write and how fast, and the report made from a log. WingmirrorAppTests covers the app itself where that can be done without a person: the questions the menu asks before it acts and what each says, the menu bar mark with and without its dot, the count of sessions waiting against a bus started for the test, the setup window's wording and its test question, and what an exported layout leaves out. Every bus a test starts takes a free port, never 7317. Two of its tests draw pictures for looking at and are skipped unless WINGMIRROR_TEST_PICTURES names a folder. The parsers are pinned to payloads captured from real sessions and the real panel, kept in Tests/fixtures/ with paths and ids replaced. Those with no capture yet are listed under Status and known limits.

The website

site/ is the website, served as it stands at https://wingmirror.app/: the landing page, and the docs under site/docs. The docs pages are not written by hand. tools/make-site-docs.py cuts this README at its second-level headings into a page each, makes a page each of docs/widget-authoring.md, docs/integrations.md and docs/ROADMAP.md, and copies tools/site-docs.css beside them as their stylesheet. It needs Python 3 and nothing else. After changing any of those files, run it and commit what it writes:

tools/make-site-docs.py

tools/make-site-docs.py --check writes nothing, and fails if the pages are out of date, if a link or a picture in them leads nowhere, or if it meets Markdown it does not understand, which it names with the file and the line. A new second-level heading in this README has to be given a page in the list at the top of the script. The checks run it.

Source layout

PathWhat
Sources/WingmirrorBusThe server: sessions, held requests, panel rules, the daily tally, static files, the token scanner. No interface of its own.
Sources/WingmirrorPanelScreen choice, the widget kit, and Resources/ with the web app, its SDK and shared backdrop, fonts and built-in widgets
Sources/WingmirrorTouchThe touch controller: seize, parse, track, and what the diagnostics say of each touch
Sources/WingmirrorDiagnosticsThe diagnostics report, made from the log
Sources/WingmirrorDisplayThe real panel: DDC/CI, the USB channel, blanking
Sources/WingmirrorHooksThe Claude Code, Codex, GitHub Copilot and Cursor connections, and their five shell scripts
Sources/WingmirrorTerminalWorking out how to bring a session's terminal forward
Sources/WingmirrorThe app: menu, windows, setup, touch delivery, the System and Git figures, the owner's actions, the MCP server, the command line
Tests/One folder of tests for each target, WingmirrorAppTests for the app among them, and fixtures: payloads, reports and readings captured from real sessions and the real panel
tools/Hardware probes, demo and replay scripts, the script that draws this README's pictures, the app and release builders
docs/BUILD_PLAN.md (the plan and every decision, with the server's contract), hardware-probe.md (what was measured on the Edge), CONVENTIONS.md (working rules), widget-authoring.md, integrations.md (connecting more coding agents), ROADMAP.md (what is not built yet), and the design mockups

The panel is plain HTML, CSS and JavaScript served by the app, with no build step. The app is one Swift package using Apple frameworks only.

Making a release

tools/make-release.sh 0.1.0

builds dist/Wingmirror-0.1.0.dmg: the app and a link to Applications. The app is built into a temporary folder, so an installed copy is left alone.

VariableEffect
WINGMIRROR_SIGN_IDENTITYA "Developer ID Application: …" name or its hash. The app and the image are signed with it, with the hardened runtime. Also read by tools/make-app.sh.
WINGMIRROR_NOTARY_PROFILEA keychain profile saved with xcrun notarytool store-credentials. The image is sent to Apple for notarisation and the ticket is stapled to it. Needs the identity.
WINGMIRROR_BUILDThe build number. The commit count unless given.
WINGMIRROR_VERSIONFor tools/make-app.sh alone: the version, 0.1.0 unless given

With neither of the first two the image is signed ad hoc. That is enough to try the packaging on the Mac that built it, and Gatekeeper warns about it anywhere else. The script prints the image's size and SHA-256. Signing with a Developer ID and notarising have not been tried yet; see Status and known limits.

Edit source on GitHub README.md#building-from-source