Create Kaleido Desktop, a cinematic Plex client for Windows

Tauri 2 shell with a React/TypeScript interface and libmpv playback composed
beneath the web view (DirectComposition on Windows). Shared code with per-OS
platform modules and configs so macOS and Linux can follow.

- Plex sign-in (browser, plex.tv/link or manual), server selection, Plex Home
- Home, Movies and TV Shows (Discover, Library, Collections), search, people
- Title pages with logos, ratings, cast, extras, seasons and episodes
- Direct play with Plex conversion fallback, tracks, markers, autoplay
- Metadata editing, artwork, fix match, refresh, analyze and deletion
- Resumable offline downloads
- App settings and Plex server administration with a live dashboard
- Signed updater feed and Forgejo CI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-10-30 16:26:37 -07:00
commit 00d72e70f4
121 changed files with 25315 additions and 0 deletions

View file

@ -0,0 +1,331 @@
import { useEffect, useState } from 'react';
import { useSettings, QUALITY_LABEL, type Quality, type SkipMode, type SubtitleMode } from '../../app/settings';
import { useSession } from '../../app/session';
import { useSections } from '../../app/queries';
import { useDownloads } from '../../downloads/store';
import { appInfo, isNative, openExternal, pickFolder, revealPath, type AppInfo } from '../../platform/native';
import { checkForUpdate, installUpdate, useUpdater } from '../../app/updater';
import { Button, Select, Switch } from '../../ui/primitives';
import { confirmDialog } from '../../ui/overlays';
import { Pref, SettingsSection } from './parts';
import { KaleidoMark } from '../../ui/primitives';
const LANGUAGES: [string, string][] = [
['', 'Automatic'],
['eng', 'English'],
['spa', 'Spanish'],
['fre', 'French'],
['ger', 'German'],
['ita', 'Italian'],
['por', 'Portuguese'],
['jpn', 'Japanese'],
['kor', 'Korean'],
['chi', 'Chinese'],
['rus', 'Russian'],
['hin', 'Hindi'],
['ara', 'Arabic'],
['dut', 'Dutch'],
['swe', 'Swedish'],
['nor', 'Norwegian'],
['dan', 'Danish'],
['fin', 'Finnish'],
['pol', 'Polish'],
['tur', 'Turkish'],
];
const qualityOptions = (Object.keys(QUALITY_LABEL) as Quality[]).map((q) => ({ value: q, label: QUALITY_LABEL[q] }));
const skipOptions: { value: SkipMode; label: string }[] = [
{ value: 'button', label: 'Show a button' },
{ value: 'auto', label: 'Skip automatically' },
{ value: 'off', label: 'Off' },
];
const SHORTCUTS: [string, string][][] = [
[
['Ctrl + K', 'Search'],
['Alt + ← / Mouse back', 'Go back'],
['Alt + → / Mouse forward', 'Go forward'],
['Esc', 'Go back or close a dialog'],
['F11', 'Full screen'],
['Ctrl + ,', 'Settings'],
['Right-click a title', 'Title actions'],
],
[
['Space or K', 'Play / pause'],
['← / →', 'Seek back / forward'],
['Shift + ← / →', 'Seek one minute'],
['J / L', 'Seek 10 seconds'],
['↑ / ↓ or scroll', 'Volume'],
['M', 'Mute'],
['F or double-click', 'Full screen'],
['C', 'Next subtitle track'],
['Shift + N', 'Next episode'],
['0–9', 'Jump to 0–90%'],
['Esc', 'Exit full screen, then the player'],
],
];
export function AppSettings({ tab }: { tab: string }) {
const s = useSettings();
const set = s.set;
const session = useSession();
const sections = useSections();
const downloads = useDownloads();
const [info, setInfo] = useState<AppInfo | null>(null);
const updater = useUpdater();
useEffect(() => {
appInfo().then(setInfo);
}, []);
const movieLibs = (sections.data ?? []).filter((x) => x.type === 'movie');
const showLibs = (sections.data ?? []).filter((x) => x.type === 'show');
switch (tab) {
case 'general':
return (
<>
<SettingsSection title="Account" description="Your Plex account and the server Kaleido is browsing.">
<Pref label={session.user?.title ?? 'Signed in with a server token'} description={session.user?.email || 'Manual connection'}>
<Button variant="ghost" size="sm" icon="logout" onClick={() => confirmDialog({ title: 'Sign out of Plex?', message: 'Downloads stay on this computer. You can sign in again at any time.', confirm: 'Sign out' }).then((ok) => void (ok && session.signOut()))}>
Sign out
</Button>
</Pref>
<Pref
label="Server"
description={
session.server
? `${session.server.name} · ${session.connection?.relay ? 'Plex Relay' : session.connection?.local ? 'Local network' : 'Remote'} · ${session.server.uri.replace(/X-Plex-Token=[^&]+/, '')}`
: ''
}
>
<Button variant="ghost" size="sm" icon="swap" onClick={session.showServerPicker} disabled={!session.accountToken}>
Change
</Button>
</Pref>
</SettingsSection>
<SettingsSection title="Browsing">
<Pref label="Start on" description="The page Kaleido opens to.">
<Select
value={s.startPage}
onChange={(v) => set('startPage', v)}
options={[
{ value: 'home', label: 'Home' },
{ value: 'movies', label: 'Movies' },
{ value: 'shows', label: 'TV Shows' },
]}
/>
</Pref>
{movieLibs.length > 1 && (
<Pref label="Movies library" description="The library shown in Movies.">
<Select value={s.movieSection || movieLibs[0].id} onChange={(v) => set('movieSection', v)} options={movieLibs.map((l) => ({ value: l.id, label: l.title }))} />
</Pref>
)}
{showLibs.length > 1 && (
<Pref label="TV Shows library" description="The library shown in TV Shows.">
<Select value={s.showSection || showLibs[0].id} onChange={(v) => set('showSection', v)} options={showLibs.map((l) => ({ value: l.id, label: l.title }))} />
</Pref>
)}
<Pref label="Mark as watched at" description="How far into a title playback counts as watched. This belongs to Kaleido and doesn’t change your server.">
<Select value={s.watchedPercent} onChange={(v) => set('watchedPercent', v)} options={[70, 75, 80, 85, 90, 95].map((v) => ({ value: v, label: `${v}%` }))} />
</Pref>
</SettingsSection>
</>
);
case 'playback':
return (
<>
<SettingsSection title="Quality" description="Original quality plays the source file directly; Kaleido decodes nearly every format, so Plex rarely needs to convert.">
<Pref label="On your local network">
<Select value={s.quality} onChange={(v) => set('quality', v)} options={qualityOptions} />
</Pref>
<Pref label="Away from home" description="Used when the server is reached remotely or through Plex Relay.">
<Select value={s.remoteQuality} onChange={(v) => set('remoteQuality', v)} options={qualityOptions} />
</Pref>
<Pref label="Hardware decoding" description="Uses your graphics card to decode video. Turn off only if you see artifacts. Applies after restarting Kaleido.">
<Switch checked={s.hwdec} onChange={(v) => set('hwdec', v)} />
</Pref>
<Pref label="HDR passthrough" description="Sends HDR video to HDR-capable displays when Windows HDR is on. Applies after restarting Kaleido.">
<Switch checked={s.hdrPassthrough} onChange={(v) => set('hdrPassthrough', v)} />
</Pref>
</SettingsSection>
<SettingsSection title="Episodes and markers" description="Intro and credits markers come from your Plex server’s analysis.">
<Pref label="Skip intros">
<Select value={s.skipIntro} onChange={(v) => set('skipIntro', v)} options={skipOptions} />
</Pref>
<Pref label="Skip credits">
<Select value={s.skipCredits} onChange={(v) => set('skipCredits', v)} options={skipOptions} />
</Pref>
<Pref label="Play the next episode automatically">
<Switch checked={s.autoplayNext} onChange={(v) => set('autoplayNext', v)} />
</Pref>
<Pref label="Countdown" description="Seconds before the next episode starts.">
<Select value={s.countdownSeconds} disabled={!s.autoplayNext} onChange={(v) => set('countdownSeconds', v)} options={[5, 8, 10, 15, 20, 30].map((v) => ({ value: v, label: `${v} seconds` }))} />
</Pref>
<Pref label="Arrow-key seek">
<Select value={s.seekStep} onChange={(v) => set('seekStep', v)} options={[5, 10, 15, 30].map((v) => ({ value: v, label: `${v} seconds` }))} />
</Pref>
</SettingsSection>
</>
);
case 'subtitles':
return (
<>
<SettingsSection title="Audio">
<Pref label="Preferred audio language" description="Automatic follows the track Plex selects for each title.">
<Select value={s.audioLanguage} onChange={(v) => set('audioLanguage', v)} options={LANGUAGES.map(([value, label]) => ({ value, label }))} />
</Pref>
</SettingsSection>
<SettingsSection title="Subtitles">
<Pref label="Show subtitles">
<Select<SubtitleMode>
value={s.subtitleMode}
onChange={(v) => set('subtitleMode', v)}
options={[
{ value: 'auto', label: 'As chosen in Plex' },
{ value: 'forced', label: 'Forced subtitles only' },
{ value: 'always', label: 'Always' },
{ value: 'off', label: 'Never' },
]}
/>
</Pref>
<Pref label="Subtitle language" description="Automatic uses the language of the audio track.">
<Select value={s.subtitleLanguage} onChange={(v) => set('subtitleLanguage', v)} options={LANGUAGES.map(([value, label]) => ({ value, label }))} />
</Pref>
<Pref label="Size">
<Select
value={s.subtitleScale}
onChange={(v) => set('subtitleScale', v)}
options={[
{ value: 0.8, label: 'Small' },
{ value: 1, label: 'Normal' },
{ value: 1.25, label: 'Large' },
{ value: 1.5, label: 'Extra large' },
]}
/>
</Pref>
<Pref label="Background box" description="Draws text subtitles on a dark box for contrast.">
<Switch checked={s.subtitleBackground} onChange={(v) => set('subtitleBackground', v)} />
</Pref>
</SettingsSection>
</>
);
case 'interface':
return (
<SettingsSection title="Interface" description="Kaleido keeps the same artwork-led look as its TV app.">
<Pref label="Artwork colour wash" description="Tints pages with colors from the title’s artwork.">
<Switch checked={s.colorWash} onChange={(v) => set('colorWash', v)} />
</Pref>
<Pref label="Rotate featured titles" description="Cycles the featured title on Home and Discover every 12 seconds.">
<Switch checked={s.heroRotation} onChange={(v) => set('heroRotation', v)} />
</Pref>
<Pref label="Poster size" description="Card size in library grids.">
<Select
value={s.posterSize}
onChange={(v) => set('posterSize', v)}
options={[
{ value: 'compact', label: 'Compact' },
{ value: 'comfortable', label: 'Comfortable' },
{ value: 'large', label: 'Large' },
]}
/>
</Pref>
<Pref label="Theme music" description="Plays a show or movie’s theme on its page.">
<Switch checked={s.themeMusic} onChange={(v) => set('themeMusic', v)} />
</Pref>
<Pref label="Theme music volume">
<Select value={s.themeVolume} disabled={!s.themeMusic} onChange={(v) => set('themeVolume', v)} options={[15, 30, 50, 75, 100].map((v) => ({ value: v, label: `${v}%` }))} />
</Pref>
<Pref label="Reduce motion" description="Turns off transitions and animations.">
<Switch checked={s.reducedMotion} onChange={(v) => set('reducedMotion', v)} />
</Pref>
</SettingsSection>
);
case 'downloads':
return (
<SettingsSection title="Offline media" description="Downloads keep the original file, so they play exactly as on your server.">
<Pref label="Download folder" description={downloads.dir || info?.defaultDownloadDir || 'Not set'}>
<Button variant="ghost" size="sm" icon="folder" disabled={!isNative} onClick={async () => {
const dir = await pickFolder(downloads.dir);
if (dir) await downloads.setDir(dir);
}}>
Change
</Button>
{downloads.dir && (
<Button variant="ghost" size="sm" onClick={() => revealPath(downloads.dir)}>
Open
</Button>
)}
</Pref>
<Pref label="Resume interrupted downloads" description="Downloads in progress when Kaleido closed continue automatically when it reconnects.">
<span className="muted">Always</span>
</Pref>
</SettingsSection>
);
case 'shortcuts':
return (
<div className="shortcut-columns">
{SHORTCUTS.map((group, i) => (
<SettingsSection key={i} title={i === 0 ? 'Browsing' : 'Player'}>
{group.map(([k, label]) => (
<Pref key={label} label={label}>
<span className="kbd">{k}</span>
</Pref>
))}
</SettingsSection>
))}
</div>
);
case 'about':
return (
<>
<div className="about-app">
<KaleidoMark size={56} />
<div>
<h2>Kaleido</h2>
<p className="muted">
Version {info?.version ?? '—'} · {info?.platform === 'windows' ? 'Windows' : info?.platform}
</p>
</div>
</div>
<SettingsSection title="Updates" description="Kaleido checks for new versions when it starts and installs them with your permission.">
<Pref
label={updater.available ? `Kaleido ${updater.available.version} is available` : updater.checking ? 'Checking…' : 'You’re up to date'}
description={updater.error || (updater.available?.notes ? updater.available.notes : updater.checkedAt ? `Last checked ${new Date(updater.checkedAt).toLocaleTimeString()}` : '')}
>
{updater.available ? (
<Button variant="primary" size="sm" icon="download" busy={updater.installing} onClick={installUpdate}>
{updater.installing ? `Installing ${Math.round(updater.progress * 100)}%` : 'Install and restart'}
</Button>
) : (
<Button variant="ghost" size="sm" icon="refresh" busy={updater.checking} disabled={!isNative} onClick={() => checkForUpdate(true)}>
Check now
</Button>
)}
</Pref>
</SettingsSection>
<SettingsSection title="Information">
<Pref label="Plex client identifier" description={localStorage.getItem('kaleido.clientId') ?? ''} />
{info?.dataDir && (
<Pref label="App data" description={info.dataDir}>
<Button variant="ghost" size="sm" onClick={() => revealPath(info.dataDir)}>
Open
</Button>
</Pref>
)}
<Pref label="Source code" description="git.elijahkuntz.com/Elijah/Kaleido-Desktop">
<Button variant="ghost" size="sm" icon="external" onClick={() => openExternal('https://git.elijahkuntz.com/Elijah/Kaleido-Desktop')}>
Open
</Button>
</Pref>
<Pref label="Reset preferences" description="Restores Kaleido’s settings. Your sign-in and downloads are kept.">
<Button variant="ghost" size="sm" onClick={() => confirmDialog({ title: 'Reset preferences?', message: 'Playback, subtitle and interface settings return to their defaults.', confirm: 'Reset' }).then((ok) => ok && s.reset())}>
Reset
</Button>
</Pref>
</SettingsSection>
<p className="legal">Kaleido is an independent project and is not affiliated with Plex. Video playback uses mpv (libmpv), licensed under the LGPL.</p>
</>
);
default:
return null;
}
}