* Options: Animation effects setting that follows the system The app eased wheel scrolling, Ctrl+wheel zoom and its fades whatever the system's animation setting was: with Windows' Animation effects off, the page still smooth-scrolled. File > Options > Accessibility > Animation effects: Use system setting (the default), On or Off; `ui.animations` for agents; kept in ui.json. - Off: a wheel notch scrolls the page its whole distance at once, egui's own scroll areas get the notch whole instead of eased in, Ctrl+wheel zoom steps at once, and egui's fades and scroll-to glides are off. Touchpad momentum and the caret blink are unchanged. - Use system setting asks the host (`Services::animations_enabled`) at start-up and when the window regains focus. Windows: the Windows Runtime's UISettings, a safe API of the `windows` crate already in the build. Web: `prefers-reduced-motion`. macOS and Linux/BSD aren't read yet (docs/gaps.md); there it means on. - The eight new strings are in all eleven interface catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Animation effects off: zoom steps land finished in one frame Follow-up to the Animation effects setting: zooming could still look animated with the setting off. - Ctrl+wheel zooms in whole steps, each at once. A mouse-wheel notch is two steps in its frame, the same zoom as before. Turns that arrive in small pieces (a touchpad pinch that Windows reports as Ctrl+wheel, a high-resolution or free-spinning wheel) add up to a step of about 10% first, where each piece used to zoom a little and the zoom glided. - A page re-rendered for a zoom step is drawn on the pixel grid in that frame. It used to be drawn off the grid, slightly soft, and snap sharp a frame later. - The frame a zoom changes in asks for the next one at once, so the status bar's percentage and slider follow in the next frame. They could lag until the caret's next blink, up to half a second. The last two apply whatever the setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Animation effects: follow the system's setting on macOS, Linux and the BSDs "Use system setting" only read Windows and the browser; elsewhere it meant on. - macOS: System Settings > Accessibility > Display > Reduce motion, through NSWorkspace (a safe call in objc2-app-kit 0.3, already in the build). - Linux and the BSDs: the XDG settings portal over D-Bus (zbus, already in the build through AccessKit). Three settings say whether animations play, and any one saying no turns them off: the cross-desktop reduced-motion preference, GNOME's enable-animations and KDE Plasma's animation speed. A thread reads them at start-up and follows the portal's change signal. Where no portal answers, or it knows none of them, KDE's kdeglobals and GTK's settings.ini are read instead. - The UI now asks the host every frame instead of at start-up and on focus, so a change in the system's settings is followed while the app runs. Hosts answer from memory: Windows and macOS are asked again at most once a second, the web keeps its media query, and Linux/BSD is kept current by its thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Animation setting on Linux: ask every setting again when one changes KDE's portal announces a new animation speed only as the cross-desktop reduced-motion preference, not under its own kdeglobals name. Keeping each setting's last announced value left KDE's own one stale: after going from instant back to normal speed, animations stayed off. Every setting is now read afresh on any relevant change, and the settings files' answer stands whenever the portal has none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Caret glide follows Animation effects; its canvas test turns the setting off, then on --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>
5.7 KiB
Control protocol
Start the app with a control port: wordcraft --control 7981 (or WORDCRAFT_CONTROL_PORT=7981).
It listens on 127.0.0.1 only. Send one JSON object per line, with the window's key (see
Keys); each gets one reply line:
{"id": 1, "key": "…", "method": "engine.execute", "params": {"command": "text.insert", "params": {"text": "Hello"}}}
{"id": 1, "ok": true, "result": {"anchor": {...}, "focus": {...}}}
Errors come back as {"id": …, "ok": false, "error": "message"}. A failed command leaves the
document unchanged. A line that isn't valid JSON gets one error reply, then the server closes the
connection (so an HTTP request sent to the port can't run a command); reconnect to continue.
Keys
Any local program (and possibly a web page) can reach a loopback port, so every request needs the
window's key. Once the port is bound, the app writes a random key (256 bits, as hex) to
<settings>/control-key.<instance> and removes the file when the window closes; a new start
writes a new key. <settings> is the folder that holds the preferences: on Linux
$XDG_CONFIG_HOME/wordcraft (by default ~/.config/wordcraft), on macOS
~/Library/Application Support/WordCraft, on Windows %APPDATA%\WordCraft. <instance> is the
Flatpak instance id inside Flatpak, and local-<port> otherwise. On Unix the file has mode 0600.
cat ~/.config/wordcraft/control-key.local-7981 # Linux, outside Flatpak, port 7981
- Send the key as top-level
"key"with every request, or once per connection with{"method": "auth", "key": "…"}(reply{"ok": true, "result": {}}); later requests on that connection may leavekeyout. Onlyauthreadsparams.key; for other methodsparams.keyis an ordinary parameter (ui.key {"key": "Enter"}presses Enter). - The key is checked on every request. A missing or wrong key gets
{"ok": false, "error": "unauthorized"}, and the app closes the connection. - A line over 1 MiB gets
{"ok": false, "error": "line too long"}, and the app closes the connection. - A connection that sends no authorised request within 30 s of being accepted is closed. That is one limit: blank lines and bad JSON do not extend it. After an authorised request the connection may stay idle.
wordcraft-cli mcp --connect takes the key from WORDCRAFT_CONTROL_KEY, or else from the key
file for the port it connects to, and reads it again on every new connection (the app may have
restarted). It sends the key only to loopback addresses (127.0.0.0/8, ::1, localhost). For
any other host it sends no key, says so, and the app refuses its requests: to drive an app on
another machine, forward its port to 127.0.0.1 (for example ssh -L 7981:127.0.0.1:7981 host)
and set WORDCRAFT_CONTROL_KEY to that app's key.
Methods
| Method | Params | Result |
|---|---|---|
engine.execute |
command, params |
the command's result (any id from engine.commands, including UI commands ui.tab, ui.dialog, ui.backstage, ui.zotero.* (see docs/zotero.md), ui.language (`{"value": "auto" |
engine.commands |
— | every command: id, label, location, shortcut, params, enabled |
document.inspect |
text? |
blocks (text, style, runs, lists, tables), parts, sections, selection, pages |
ui.inspect |
— | UI state, view, dialog, window size, page rects on screen, caret, comment balloons (balloons: id + screen rect; balloon: the selected one), perf |
ui.click |
x, y, button?, count?, shift?, cmd?, alt? |
real pointer input at window coordinates |
ui.clickText |
page (0-based), x, y (points from the page's top-left), count? |
click inside a page |
ui.move / ui.drag |
x,y / x,y,toX,toY,steps? |
pointer move / drag |
ui.press / ui.release |
x,y, modifiers |
primary button down / up there (with ui.move between: a drag you can screenshot halfway) |
ui.key |
key (B, Enter, Left…), shift?, alt?, cmd? |
key press through egui (shortcuts apply) |
ui.text |
text |
typed text through egui |
ui.screenshot |
path? |
PNG of the window: written to path, or without one returned as base64 png in the reply |
ui.render |
path?, page? (1-based), scale? |
PNG of a page, rendered by the engine: written to path, or without one returned as base64 png in the reply (never a fixed name in the shared temporary folder) |
ui.parity |
— | feature-catalog parity |
ui.resize / ui.focus / app.quit |
window control |
Any other method name is treated as a command id: {"method": "format.bold"} works.
Positions are {"story": "body" | {"part": n}, "path": [block, row, cell, block, …], "off": byteOffset}.