Kaleido-Desktop/src/main.tsx
Elijah Kuntz 7d0803481b 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>
2026-11-02 15:14:40 -07:00

41 lines
1.5 KiB
TypeScript

import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import '@fontsource-variable/inter';
import './styles/base.css';
import './styles/ui.css';
import './styles/app.css';
import './styles/screens.css';
import './styles/player.css';
import { App } from './app/App';
import { installKeyboardNav } from './app/keyboardNav';
import { useSession } from './app/session';
import { useRouter } from './app/router';
import { usePlayer } from './player/store';
import { useSettings } from './app/settings';
import { useDownloads } from './downloads/store';
import { hostOS, isMac, isNative, win } from './platform/native';
if (import.meta.env.DEV) (window as any).__kaleido = { useSession, useRouter, usePlayer, useSettings, useDownloads };
// No browser context menu or text-selection chrome outside inputs: this is an app.
window.addEventListener('contextmenu', (e) => {
const t = e.target as HTMLElement;
if (!t.closest('input, textarea, .selectable')) e.preventDefault();
});
installKeyboardNav();
// Platform styling: macOS keeps its traffic lights at the top left, except in
// full screen, where the system hides them.
document.documentElement.classList.add(`os-${hostOS}`);
if (isNative && isMac) {
const syncFullscreen = () => win.isFullscreen().then((fs) => document.documentElement.classList.toggle('window-fullscreen', fs));
syncFullscreen();
win.onResized(syncFullscreen);
}
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
);