From 4748e3ea2fd99e67d36b4c6d41d47869d36ab6bb Mon Sep 17 00:00:00 2001 From: hl-valdemar Date: Sun, 18 Oct 2026 23:06:37 +0200 Subject: [PATCH] feat: fix start screen window dimensions --- README.md | 2 +- Sources/App/TerebiApp.swift | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f287f5f..d8409d8 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Builds are ad-hoc signed for personal use, not notarized. Bundled licenses and s Open one or more local files with **⌘O**, drag them onto the video, or use Finder's **Open With**. A selection replaces the session's queue and plays in natural filename order (for example, episode 2 before episode 10). Open YouTube with **⇧⌘O** or drop a video link. Media starts automatically and resumes its saved position; finished videos restart from the beginning. Live and audio-only media do not save progress. -The start screen uses a two-pane layout: Terebi's identity and version on the left; **Open…**, **Open URL…**, and the six most recently played local files or YouTube videos on the right. Shortcut hints follow your configured bindings. **Open URL…** reveals a focused inline YouTube field. When the most recent item has saved progress, it appears once as a **Resume** row with its saved timestamp. Recent titles and ordering survive relaunches; failed opens are not added. Resolved streams are excluded because reopening them requires a fresh external handoff. The action pane scrolls in small windows, and drag-and-drop remains available. +The start screen uses a fixed 640 × 400-point two-pane window: Terebi's identity and version on the left; **Open…**, **Open URL…**, and the six most recently played local files or YouTube videos on the right. Opening media restores normal resizing; closing media returns to the fixed start size. Shortcut hints follow your configured bindings. **Open URL…** reveals a focused inline YouTube field. When the most recent item has saved progress, it appears once as a **Resume** row with its saved timestamp. Recent titles and ordering survive relaunches; failed opens are not added. Resolved streams are excluded because reopening them requires a fresh external handoff. The action pane scrolls, and drag-and-drop remains available. | Action | Default shortcut | | --- | --- | diff --git a/Sources/App/TerebiApp.swift b/Sources/App/TerebiApp.swift index 223bc87..494ce6c 100644 --- a/Sources/App/TerebiApp.swift +++ b/Sources/App/TerebiApp.swift @@ -513,6 +513,7 @@ final class PlayerModel: ObservableObject { } return } + if fileName == nil { configureStartWindow(showing: false) } transition.acceptOpen(revision: revision, source: source, change: change, savedPosition: savedPosition) queuePlaybackRevision = queue.currentID == nil ? nil : player_get_state(handle).revision queueCompletionHandled = false @@ -710,6 +711,7 @@ final class PlayerModel: ObservableObject { isSeeking = false window?.representedURL = nil window?.title = "Terebi" + configureStartWindow(showing: true) revealControls() systemPlayback?.update() } @@ -835,9 +837,26 @@ final class PlayerModel: ObservableObject { } compactWindow.attach(window) updateWindowState() + if fileName == nil { configureStartWindow(showing: true) } fitVideoWindow() } + private func configureStartWindow(showing: Bool) { + guard let window else { return } + if showing { + let size = NSSize(width: 640, height: 400) + window.resizeIncrements = NSSize(width: 1, height: 1) + window.contentMinSize = size + window.contentMaxSize = size + window.setContentSize(size) + window.styleMask.remove(.resizable) + } else { + window.styleMask.insert(.resizable) + window.contentMaxSize = NSSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude) + window.contentMinSize = NSSize(width: 400, height: 240) + } + } + func updateWindowState() { guard let window else { return } isFullScreen = window.styleMask.contains(.fullScreen)