diff --git a/CHANGELOG.md b/CHANGELOG.md index 5336201..8f573d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,24 +1,5 @@ # Changelog -## 0.1.0-beta.2 - -Second beta: fixes and changes from testing the first. - -- New startup animation: the iris opens and the view flies through the aperture, as on Kaleido for TV. -- Miniplayer: the player's back arrow (or Esc) keeps the video playing in the corner while you browse. -- Window controls stay available in the player, and its controls also hide when the pointer leaves the window. -- Playback options now include audio and subtitle tracks, audio sync, the source bitrate for Original quality, subtitle size and background, and playback details. -- Subtitle styling in Settings (size, colour, edge, background, bold, position) with a live preview. -- Categories replace Collections in Movies and TV Shows: genre tiles with artwork that open a filtered library. -- Smoother scrolling: per-card and scrolling backdrop blurs were re-rendering every frame. -- The artwork colour wash is visible again and carries down the page. -- The volume slider follows loudness (halfway is about half as loud), and theme music is much quieter and follows the player volume. -- Search keeps results on screen while you type; the A–Z rail is easier to see and magnifies under the pointer; long descriptions expand when clicked. -- Featured titles rotate faster and preload their artwork; hovering Continue Watching shows a preview. -- Downloads: Remove all (everything, a show, or all movies) and a simpler page. -- Removed: the five-star rating, the duplicate Settings entry in the profile menu and the server settings' Show advanced switch (everything is shown). -- Fixed: double focus ring in search, a stray dot under the navigation, and overlapping text on the TV Shows header. - ## 0.1.0-beta.1 First beta of Kaleido for Windows. diff --git a/docs/architecture.md b/docs/architecture.md index 740d222..5af3343 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -13,7 +13,7 @@ src/ Shared interface (all platforms) plex/ Plex client: account (plex.tv), library API, admin, playback, parsing player/ Playback controller (store.ts), mpv bridge, player overlay downloads/ Download catalog and actions - screens/ Home, Movies/TV (Discover/Library/Categories), title pages, + screens/ Home, Movies/TV (Discover/Library/Collections), title pages, search, people, downloads, settings, dialogs ui/ Design system: primitives, menus/dialogs/toasts, cards, hero styles/ Tokens and styles (base, ui, app, screens, player) @@ -37,14 +37,14 @@ 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`). | +| `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. | | `MPV_LIBRARIES` | `libmpv-2.dll` | | `hold_awake` | `SetThreadExecutionState` while video plays | 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 +the same five methods. 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`. @@ -67,9 +67,6 @@ transparent only while video is visible (`html.video-active`), so browsing is op timestamps kept absolute. If direct play fails, playback retries through Plex once. Plex streams are matched to mpv tracks by stream index; external subtitles are added on demand. Timeline reports every 10 seconds make the session appear in Plex, and the - title is marked watched at the configured percentage. The player's back arrow (or Esc) - shrinks playback into a miniplayer: the video is drawn in a corner rectangle and the - interface stays visible around it, with a matching hole masked out of the page - (`html.player-mini`). + title is marked watched at the configured percentage. - **Updates**: `app/updater.ts` checks the signed feed on start; installs need the user's confirmation and then relaunch. diff --git a/package-lock.json b/package-lock.json index ca9d7b8..bfbd96a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kaleido-desktop", - "version": "0.1.0-beta.2", + "version": "0.1.0-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kaleido-desktop", - "version": "0.1.0-beta.2", + "version": "0.1.0-beta.1", "dependencies": { "@fontsource-variable/inter": "^5.3.0", "@tanstack/react-query": "^5.105.0", diff --git a/package.json b/package.json index e2aed65..9c025d3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "kaleido-desktop", "private": true, - "version": "0.1.0-beta.2", + "version": "0.1.0-beta.1", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 8f0e730..561e6c3 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2173,7 +2173,7 @@ dependencies = [ [[package]] name = "kaleido" -version = "0.1.0-beta.2" +version = "0.1.0-beta.1" dependencies = [ "fs2", "futures-util", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d9adbcf..2962b0c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kaleido" -version = "0.1.0-beta.2" +version = "0.1.0-beta.1" description = "Kaleido — a Plex client for Windows" authors = ["Elijah"] edition = "2021" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index dba919c..3fad8f2 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -40,7 +40,6 @@ pub fn run() { .invoke_handler(tauri::generate_handler![ player::player_init, player::player_show, - player::player_rect, player::player_command, player::player_set, player::player_get, diff --git a/src-tauri/src/platform/linux.rs b/src-tauri/src/platform/linux.rs index 5609089..d287122 100644 --- a/src-tauri/src/platform/linux.rs +++ b/src-tauri/src/platform/linux.rs @@ -23,7 +23,6 @@ impl VideoSurface { pub fn on_property(&mut self, _: &str, _: &serde_json::Value) {} pub fn show(&mut self, _: bool) {} pub fn fit(&mut self, _: &WebviewWindow, _: Option<&Mpv>) {} - pub fn set_rect(&mut self, _: &WebviewWindow, _: Option<&Mpv>, _: Option<(i32, i32, i32, i32)>) {} } pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { diff --git a/src-tauri/src/platform/macos.rs b/src-tauri/src/platform/macos.rs index 638cee2..44a51bc 100644 --- a/src-tauri/src/platform/macos.rs +++ b/src-tauri/src/platform/macos.rs @@ -23,7 +23,6 @@ impl VideoSurface { pub fn on_property(&mut self, _: &str, _: &serde_json::Value) {} pub fn show(&mut self, _: bool) {} pub fn fit(&mut self, _: &WebviewWindow, _: Option<&Mpv>) {} - pub fn set_rect(&mut self, _: &WebviewWindow, _: Option<&Mpv>, _: Option<(i32, i32, i32, i32)>) {} } pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { diff --git a/src-tauri/src/platform/mod.rs b/src-tauri/src/platform/mod.rs index 4d5f5e0..2478be7 100644 --- a/src-tauri/src/platform/mod.rs +++ b/src-tauri/src/platform/mod.rs @@ -2,7 +2,7 @@ //! Each platform file exposes the same items: //! //! - `VideoSurface`: composes mpv's output beneath the web view -//! (`create`, `mpv_options`, `on_property`, `show`, `fit`, `set_rect`). +//! (`create`, `mpv_options`, `on_property`, `show`, `fit`). //! - `SURFACE_PROPERTIES`: mpv properties the surface observes. //! - `MPV_LIBRARIES`: libmpv file names to look for. //! - `hold_awake`: prevents display sleep until the receiver closes. diff --git a/src-tauri/src/platform/windows.rs b/src-tauri/src/platform/windows.rs index 9eb1777..9ec0543 100644 --- a/src-tauri/src/platform/windows.rs +++ b/src-tauri/src/platform/windows.rs @@ -15,8 +15,6 @@ pub struct VideoSurface { _target: IDCompositionTarget, root: IDCompositionVisual, visible: bool, - /// Where the video is drawn, in client pixels; `None` fills the window. - rect: Option<(i32, i32, i32, i32)>, pub width: i32, pub height: i32, } @@ -51,7 +49,6 @@ impl VideoSurface { _target: target, root, visible: false, - rect: None, width, height, }) @@ -105,20 +102,9 @@ impl VideoSurface { } } - /// Matches mpv's composition size and the visual's position to the - /// window's client area, or to the miniplayer rectangle when one is set. pub fn fit(&mut self, window: &WebviewWindow, mpv: Option<&Mpv>) { let Ok(h) = window.hwnd() else { return }; - let (cw, ch) = client_size(HWND(h.0 as _)); - let (x, y, w, h) = match self.rect { - Some((x, y, w, h)) => (x, y, w.max(16), h.max(16)), - None => (0, 0, cw, ch), - }; - unsafe { - let _ = self.root.SetOffsetX2(x as f32); - let _ = self.root.SetOffsetY2(y as f32); - let _ = self.device.Commit(); - } + let (w, h) = client_size(HWND(h.0 as _)); if (w, h) == (self.width, self.height) { return; } @@ -128,11 +114,6 @@ impl VideoSurface { let _ = mpv.set_property("d3d11-composition-size", &serde_json::Value::String(format!("{w}x{h}"))); } } - - pub fn set_rect(&mut self, window: &WebviewWindow, mpv: Option<&Mpv>, rect: Option<(i32, i32, i32, i32)>) { - self.rect = rect; - self.fit(window, mpv); - } } /// mpv properties the surface needs to observe. diff --git a/src-tauri/src/player.rs b/src-tauri/src/player.rs index 0e8cb5f..43f2d3e 100644 --- a/src-tauri/src/player.rs +++ b/src-tauri/src/player.rs @@ -180,28 +180,6 @@ pub async fn player_show(app: AppHandle, window: WebviewWindow Ok(()) } -#[derive(Deserialize)] -pub struct VideoRect { - x: f64, - y: f64, - width: f64, - height: f64, -} - -/// Draws the video in a rectangle of the window (physical pixels), for the -/// miniplayer; `None` fills the window again. -#[tauri::command] -pub async fn player_rect(app: AppHandle, window: WebviewWindow, rect: Option) -> Result<(), String> { - let state = app.state::(); - let mpv = state.mpv.lock().clone(); - let mut surface = state.surface.lock(); - if let Some(surface) = surface.as_mut() { - let rect = rect.map(|r| (r.x.round() as i32, r.y.round() as i32, r.width.round() as i32, r.height.round() as i32)); - surface.set_rect(&window, mpv.as_deref(), rect); - } - Ok(()) -} - #[tauri::command] pub async fn player_command(app: AppHandle, args: Vec) -> Result<(), String> { player(&app)?.command(&args) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index db9d5a8..e9fa96a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Kaleido", - "version": "0.1.0-beta.2", + "version": "0.1.0-beta.1", "identifier": "tv.kaleido.desktop", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/app/App.tsx b/src/app/App.tsx index 7c98113..77cf583 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -33,7 +33,7 @@ function Screen({ route }: { route: Route }) { case 'home': return ; case 'section': - return ; + return ; case 'item': return ; case 'person': @@ -94,9 +94,8 @@ function Page({ onScrolled }: { onScrolled: (top: number) => void }) { function useGlobalShortcuts() { useEffect(() => { const isTyping = (t: EventTarget | null) => t instanceof HTMLElement && (t.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(t.tagName)); - const playerFull = () => usePlayer.getState().open && !usePlayer.getState().mini; const onKey = (e: KeyboardEvent) => { - if (playerFull()) return; + if (usePlayer.getState().open) return; if ((e.ctrlKey || e.metaKey) && (e.key === 'k' || e.key === 'f')) { e.preventDefault(); navigate({ name: 'search' }); @@ -119,7 +118,7 @@ function useGlobalShortcuts() { }; // Mouse back/forward buttons. const onMouse = (e: MouseEvent) => { - if (playerFull()) return; + if (usePlayer.getState().open) return; if (e.button === 3) { e.preventDefault(); useRouter.getState().back(); @@ -145,7 +144,7 @@ function useLibrarySync() { let last = ''; let stopped = false; const tick = async () => { - if (stopped || document.hidden || (usePlayer.getState().open && !usePlayer.getState().mini)) return; + if (stopped || document.hidden || usePlayer.getState().open) return; try { const rev = await libraryRevision(server); if (last && rev !== last) invalidateLibrary(); @@ -168,7 +167,7 @@ function useLibrarySync() { function Shell() { const [scrolled, setScrolled] = useState(false); - const playerOpen = usePlayer((s) => s.open && !s.mini); + const playerOpen = usePlayer((s) => s.open); const startPage = useSettings.getState().startPage; useGlobalShortcuts(); useLibrarySync(); diff --git a/src/app/TopBar.tsx b/src/app/TopBar.tsx index 33e7b80..0e05da2 100644 --- a/src/app/TopBar.tsx +++ b/src/app/TopBar.tsx @@ -16,7 +16,7 @@ const NAV = [ { id: 'downloads', label: 'Downloads', route: { name: 'downloads' } as const }, ]; -export function WindowControls() { +function WindowControls() { const [maximized, setMaximized] = useState(false); useEffect(() => { if (!isNative) return; @@ -67,8 +67,11 @@ function Avatar() { submenu: home.users.map((u) => ({ label: u.title, checked: u.uuid === user?.uuid, onSelect: () => home.switchTo(u) })), }); } - // Settings has its own button in the bar; the menu keeps account actions. - if (server?.owned) items.push({ divider: true }, { label: 'Server dashboard', icon: 'activity', onSelect: () => navigate({ name: 'settings', mode: 'server', tab: 'dashboard' }) }); + items.push( + { divider: true }, + { label: 'Settings', icon: 'settings', onSelect: () => navigate({ name: 'settings', mode: 'app', tab: 'general' }) }, + ); + if (server?.owned) items.push({ label: 'Server dashboard', icon: 'activity', onSelect: () => navigate({ name: 'settings', mode: 'server', tab: 'dashboard' }) }); items.push({ divider: true }, { label: 'Sign out', icon: 'logout', onSelect: signOut }); openMenu(items, el, { align: 'end', minWidth: 250 }); }; diff --git a/src/app/router.ts b/src/app/router.ts index 14a5c6f..943b176 100644 --- a/src/app/router.ts +++ b/src/app/router.ts @@ -1,11 +1,11 @@ import { create } from 'zustand'; export type SectionKind = 'movie' | 'show'; -export type SectionTab = 'discover' | 'library' | 'categories'; +export type SectionTab = 'discover' | 'library' | 'collections'; export type Route = | { name: 'home' } - | { name: 'section'; kind: SectionKind; tab: SectionTab; genre?: string; genreTitle?: string } + | { name: 'section'; kind: SectionKind; tab: SectionTab } | { name: 'item'; id: string; title?: string } | { name: 'person'; id: string; title: string; thumb?: string } | { name: 'hub'; key: string; title: string } diff --git a/src/app/settings.ts b/src/app/settings.ts index b921e3a..314a7cd 100644 --- a/src/app/settings.ts +++ b/src/app/settings.ts @@ -4,9 +4,6 @@ import { persist } from 'zustand/middleware'; export type Quality = 'original' | '2160' | '1080' | '720' | '480'; export type SkipMode = 'off' | 'button' | 'auto'; export type SubtitleMode = 'auto' | 'always' | 'forced' | 'off'; -export type SubtitleEdge = 'outline' | 'shadow' | 'raised' | 'none'; -export type SubtitleBox = 'none' | 'translucent' | 'solid'; -export type SubtitlePosition = 'low' | 'normal' | 'high'; export interface Preferences { // Playback @@ -23,11 +20,7 @@ export interface Preferences { subtitleMode: SubtitleMode; subtitleLanguage: string; subtitleScale: number; - subtitleColor: string; - subtitleEdge: SubtitleEdge; - subtitleBox: SubtitleBox; - subtitleBold: boolean; - subtitlePosition: SubtitlePosition; + subtitleBackground: boolean; volume: number; seekStep: number; // Interface @@ -61,11 +54,7 @@ export const defaults: Preferences = { subtitleMode: 'auto', subtitleLanguage: '', subtitleScale: 1, - subtitleColor: '#FFFFFF', - subtitleEdge: 'outline', - subtitleBox: 'none', - subtitleBold: false, - subtitlePosition: 'normal', + subtitleBackground: false, volume: 100, seekStep: 10, startPage: 'home', @@ -93,19 +82,7 @@ export const useSettings = create()( set: (key, value) => set({ [key]: value } as Partial), reset: () => set({ ...defaults }), }), - { - name: 'kaleido.settings', - version: 2, - migrate: (persisted, version) => { - const p = (persisted ?? {}) as Record; - // 1 → 2: the subtitle background switch became a box style. - if (version < 2 && 'subtitleBackground' in p) { - p.subtitleBox = p.subtitleBackground ? 'translucent' : 'none'; - delete p.subtitleBackground; - } - return p as unknown as SettingsState; - }, - }, + { name: 'kaleido.settings', version: 1 }, ), ); @@ -123,15 +100,3 @@ export const QUALITY_PROFILE: Record, { kbps: numbe '720': { kbps: 4000, width: 1280, height: 720 }, '480': { kbps: 1500, width: 854, height: 480 }, }; - -export const SUBTITLE_COLORS: { value: string; label: string }[] = [ - { value: '#FFFFFF', label: 'White' }, - { value: '#FFE14D', label: 'Yellow' }, - { value: '#7FE3F0', label: 'Cyan' }, - { value: '#9BE58A', label: 'Green' }, - { value: '#F4A6D7', label: 'Pink' }, - { value: '#BFC5CA', label: 'Grey' }, -]; - -/** Bottom margin in mpv's scaled pixels (720 = window height). */ -export const SUBTITLE_MARGIN: Record = { low: 14, normal: 34, high: 80 }; diff --git a/src/main.tsx b/src/main.tsx index b0fc91d..ccf9b98 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -12,9 +12,8 @@ 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'; -if (import.meta.env.DEV) (window as any).__kaleido = { useSession, useRouter, usePlayer, useSettings, useDownloads }; +if (import.meta.env.DEV) (window as any).__kaleido = { useSession, useRouter, usePlayer, useSettings }; // No browser context menu or text-selection chrome outside inputs: this is an app. window.addEventListener('contextmenu', (e) => { diff --git a/src/player/PlayerOverlay.tsx b/src/player/PlayerOverlay.tsx index 3ee8dab..9a026c9 100644 --- a/src/player/PlayerOverlay.tsx +++ b/src/player/PlayerOverlay.tsx @@ -1,51 +1,30 @@ import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react'; import { usePlayer } from './store'; import { useSession } from '../app/session'; -import { useSettings, QUALITY_LABEL, type Quality, type SubtitleBox } from '../app/settings'; -import { bitrate, channelLabel, clock, episodeLabel, resolutionLabel } from '../app/format'; +import { useSettings, QUALITY_LABEL, type Quality } from '../app/settings'; +import { clock, episodeLabel } from '../app/format'; import { Icon } from '../ui/Icon'; import { Facts, TitleArt } from '../ui/media'; import { Button, Spinner } from '../ui/primitives'; import { win, isNative } from '../platform/native'; -import { WindowControls } from '../app/TopBar'; -import { mpv } from './engine'; import type { Item } from '../plex/types'; const HIDE_AFTER = 3000; -/** - * Controls show on pointer movement and hide after a few seconds of stillness, - * or straight away when the pointer leaves the window. They stay while paused - * (until the pointer leaves) and while a panel is open or the timeline is held. - */ function useAutoHide(paused: boolean, pinned: boolean) { const [visible, setVisible] = useState(true); const timer = useRef | null>(null); - const state = useRef({ paused, pinned }); - state.current = { paused, pinned }; const poke = useCallback(() => { setVisible(true); if (timer.current) clearTimeout(timer.current); - timer.current = null; - if (!state.current.paused && !state.current.pinned) timer.current = setTimeout(() => setVisible(false), HIDE_AFTER); + timer.current = setTimeout(() => setVisible(false), HIDE_AFTER); }, []); useEffect(() => { - poke(); + if (paused || pinned) { + if (timer.current) clearTimeout(timer.current); + setVisible(true); + } else poke(); }, [paused, pinned, poke]); - useEffect(() => { - const leave = () => { - if (state.current.pinned) return; - if (timer.current) clearTimeout(timer.current); - timer.current = null; - setVisible(false); - }; - const root = document.documentElement; - root.addEventListener('mouseleave', leave); - return () => { - root.removeEventListener('mouseleave', leave); - if (timer.current) clearTimeout(timer.current); - }; - }, []); return { visible, poke }; } @@ -144,27 +123,20 @@ function Timeline({ onScrub }: { onScrub: (active: boolean) => void }) { ); } -function Panel({ title, onClose, onBack, children, className = '' }: { title: string; onClose: () => void; onBack?: () => void; children: ReactNode; className?: string }) { +function Panel({ title, onClose, children, className = '' }: { title: string; onClose: () => void; children: ReactNode; className?: string }) { useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { e.stopPropagation(); - (onBack ?? onClose)(); + onClose(); } }; window.addEventListener('keydown', onKey, true); return () => window.removeEventListener('keydown', onKey, true); - }, [onClose, onBack]); + }, [onClose]); return (
e.stopPropagation()} onDoubleClick={(e) => e.stopPropagation()}> -
- {onBack && ( - - )} - {title} -
+
{title}
{children}
); @@ -200,145 +172,58 @@ function TracksPanel({ onClose }: { onClose: () => void }) { {st.subTracks.map((t) => (