Port Kaleido Desktop to macOS
macOS (Apple silicon) now plays, browses and updates like Windows: - Video: libmpv's render API draws into a CAOpenGLLayer beneath the WKWebView, with the miniplayer rectangle, HDR passthrough through extended dynamic range (PQ/BT.2020) and display-sleep prevention. - Window: native traffic lights on the top bar's centre line, hidden with the player's controls; the page's caption buttons are Windows-only. - Interface: macOS shortcut labels (⌘K, ⌘[, ⌃⌘F), Plex identifies the player as a Mac, and header values are kept ASCII (Mac computer names usually contain a curly apostrophe). - The window appears without waiting for an animation frame, which WKWebView doesn't run in a hidden window. - Credentials: release builds use the Keychain and are signed with a lasting self-signed certificate so access survives updates; debug builds keep tokens in a private file to avoid prompts on every rebuild. - Bundling: scripts/fetch-libmpv.sh makes Homebrew's libmpv and its libraries self-contained; scripts/build.sh builds the .app, .dmg and signed update archive. Releases now carry both platforms: publish-release.mjs uploads each machine's build into one release, and update-manifest.mjs writes the feed from that release's assets, refusing while a platform is missing. The updater uses a new signing key (public key in tauri.conf.json), so existing installs must be reinstalled once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a3c05e9062
commit
7d0803481b
39 changed files with 1191 additions and 230 deletions
|
|
@ -35,21 +35,34 @@ updates/latest.json Signed update feed for every platform
|
|||
`src-tauri/src/platform/mod.rs` selects one of `windows.rs`, `macos.rs` or `linux.rs`.
|
||||
Each exposes the same items:
|
||||
|
||||
| Item | Windows implementation |
|
||||
| --- | --- |
|
||||
| `VideoSurface` | mpv renders with `d3d11-output-mode=composition`; its swapchain (`display-swapchain`) is set as the content of a DirectComposition visual targeted at the window with `topmost = false`, i.e. behind the web view's child windows. For the miniplayer the visual is offset and mpv's composition size shrunk to a corner rectangle (`player_rect`). |
|
||||
| `MPV_LIBRARIES` | `libmpv-2.dll` |
|
||||
| `hold_awake` | `SetThreadExecutionState` while video plays |
|
||||
| Item | Windows | macOS |
|
||||
| --- | --- | --- |
|
||||
| `VideoSurface` | mpv renders with `d3d11-output-mode=composition`; its swapchain (`display-swapchain`) is set as the content of a DirectComposition visual targeted at the window with `topmost = false`, i.e. behind the web view's child windows. For the miniplayer the visual is offset and mpv's composition size shrunk to a corner rectangle (`player_rect`). | mpv's render API (`vo=libmpv`, OpenGL) draws into a `CAOpenGLLayer` hosted by a view inserted beneath the WKWebView, whose background is turned off (`drawsBackground`). `start` creates the render context once mpv is initialized; a render thread redraws the layer whenever mpv reports a new frame. For the miniplayer the view is moved to the corner rectangle. |
|
||||
| `MPV_LIBRARIES` | `libmpv-2.dll` | `libmpv.2.dylib` (in `Contents/Frameworks` with the libraries it links) |
|
||||
| `hold_awake` | `SetThreadExecutionState` | an IOKit `PreventUserIdleDisplaySleep` assertion |
|
||||
| Window buttons | drawn by the page (`WindowControls`) | the native traffic lights (`titleBarStyle: Overlay`, placed on the top bar's centre line); `set_window_buttons` hides them with the player's controls |
|
||||
| `device_name` | `COMPUTERNAME` | the computer name from Sharing settings |
|
||||
|
||||
macOS and Linux currently provide stubs for `VideoSurface` (browsing, downloads,
|
||||
settings and updates work; playback reports that it is unavailable). To add playback
|
||||
there, render through mpv's render API into a layer beneath the web view and implement
|
||||
the same methods (`set_rect` places the video in part of the window for the miniplayer). Per-OS bundling (libmpv, targets, dependencies) lives in
|
||||
`tauri.macos.conf.json` and `tauri.linux.conf.json`. Credentials use the platform's
|
||||
keychain through the `keyring` crate with per-OS features in `Cargo.toml`.
|
||||
Linux provides stubs for `VideoSurface` (browsing, downloads, settings and updates
|
||||
work; playback reports that it is unavailable); the macOS approach (render API beneath
|
||||
the web view) applies there with an OpenGL surface under WebKitGTK. Per-OS bundling
|
||||
(libmpv, targets, window style) lives in `tauri.<os>.conf.json`. Credentials use the
|
||||
platform's keychain through the `keyring` crate with per-OS features in `Cargo.toml`;
|
||||
macOS debug builds keep them in a private file instead, because each unsigned rebuild
|
||||
would make the Keychain ask again.
|
||||
|
||||
On Windows the main window is created transparent and the page background turns
|
||||
transparent only while video is visible (`html.video-active`), so browsing is opaque.
|
||||
The page background turns transparent only while video is visible
|
||||
(`html.video-active`), so browsing is opaque. The page knows its OS synchronously
|
||||
(`hostOS` in `platform/native.ts`, from the web view's user agent) and tags the root
|
||||
element (`html.os-macos`) for the few styles that differ, such as room for the traffic
|
||||
lights.
|
||||
|
||||
HDR passthrough (`target-colorspace-hint`) works differently on each OS. On Windows mpv
|
||||
switches its swapchain's colour space itself. On macOS the surface watches
|
||||
`video-params/gamma`: for PQ or HLG video it has mpv output PQ in BT.2020
|
||||
(`target-trc`, `target-prim`) into the 16-bit float framebuffer and turns on the layer's
|
||||
extended dynamic range with the BT.2100 PQ colour space, so macOS maps the picture
|
||||
into the display's HDR headroom; SDR video returns both to their defaults.
|
||||
|
||||
## Interface
|
||||
|
||||
|
|
@ -85,4 +98,5 @@ transparent only while video is visible (`html.video-active`), so browsing is op
|
|||
cached in the app cache folder (`gpu-shader-cache-dir`), so a slow first Direct3D
|
||||
compile happens once per shader set, mpv version and GPU driver.
|
||||
- **Updates**: `app/updater.ts` checks the signed feed on start; installs need the
|
||||
user's confirmation and then relaunch.
|
||||
user's confirmation and then relaunch. One release carries every platform's build and
|
||||
the feed lists each of them (`windows-x86_64`, `darwin-aarch64`).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue