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:
Elijah Kuntz 2026-11-02 15:14:40 -07:00
parent a3c05e9062
commit 7d0803481b
39 changed files with 1191 additions and 230 deletions

View file

@ -71,7 +71,9 @@ fn create_player<R: Runtime>(app: &AppHandle<R>, window: &WebviewWindow<R>, opts
set("hwdec", opts.hwdec.as_deref().unwrap_or("auto-safe"))?;
set("keep-open", "yes")?;
set("idle", "yes")?;
set("force-window", "yes")?;
if !render_options.iter().any(|(k, _)| *k == "force-window") {
set("force-window", "yes")?;
}
set("osc", "no")?;
set("osd-level", "0")?;
set("input-default-bindings", "no")?;
@ -107,6 +109,9 @@ fn create_player<R: Runtime>(app: &AppHandle<R>, window: &WebviewWindow<R>, opts
}
mpv.request_log_messages("warn");
mpv.initialize()?;
if let Some(surface) = app.state::<PlayerState>().surface.lock().as_mut() {
surface.start(&mpv)?;
}
for (i, name) in OBSERVED.iter().chain(crate::platform::SURFACE_PROPERTIES).enumerate() {
mpv.observe(i as u64 + 1, name);
}
@ -183,7 +188,7 @@ pub async fn player_show<R: Runtime>(app: AppHandle<R>, window: WebviewWindow<R>
let mut surface = state.surface.lock();
if let Some(surface) = surface.as_mut() {
surface.fit(&window, mpv.as_deref());
surface.show(visible);
surface.show(&window, visible);
}
Ok(())
}
@ -225,6 +230,13 @@ pub async fn player_get<R: Runtime>(app: AppHandle<R>, name: String) -> Result<V
player(&app)?.get_property(&name)
}
/// Shows or hides the native window buttons where the OS draws them (the
/// macOS traffic lights fade with the player's controls).
#[tauri::command]
pub fn window_buttons<R: Runtime>(window: WebviewWindow<R>, visible: bool) {
crate::platform::set_window_buttons(&window, visible);
}
/// Keeps the video surface matched to the window's client area.
pub fn on_resize<R: Runtime>(window: &WebviewWindow<R>) {
let app = window.app_handle();