From eb01c075526f46e6b2fee861f44acc57817f949e Mon Sep 17 00:00:00 2001 From: psavarmattas Date: Fri, 14 Aug 2026 01:00:13 +0100 Subject: [PATCH] fix(collections): update window title on collection/document selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .navigationTitle was hardcoded to the team name and never changed — the actual macOS window title stayed on the workspace name even with a collection or document open, while only the custom toolbar pill updated. Now computed with the same priority so both agree. --- .../Collections/ContentView_macOS.swift | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Outpost/Features/Collections/ContentView_macOS.swift b/Outpost/Features/Collections/ContentView_macOS.swift index 7fb7ab3..74dfd25 100644 --- a/Outpost/Features/Collections/ContentView_macOS.swift +++ b/Outpost/Features/Collections/ContentView_macOS.swift @@ -14,6 +14,20 @@ struct ContentView_macOS: View { globalSearchQuery.trimmingCharacters(in: .whitespacesAndNewlines) } + /// Mirrors leadingToolbarContent's priority (search > document > collection + /// > workspace) so the actual window title and the custom pill agree. + private var windowTitle: String { + if !trimmedGlobalQuery.isEmpty { + return "Search" + } else if let currentDocument = documentPath.last { + return currentDocument.title.isEmpty ? "Untitled" : currentDocument.title + } else if let selectedCollection { + return selectedCollection.name + } else { + return session.teamName ?? "Outpost" + } + } + var body: some View { NavigationSplitView { VStack(spacing: 0) { @@ -26,7 +40,10 @@ struct ContentView_macOS: View { } detail: { detail } - .navigationTitle(session.teamName ?? "Outpost") + // Was hardcoded to the team name and never updated — the actual macOS + // window title (separate from the leadingToolbarContent pill below) + // stayed on the workspace name even with a collection/document open. + .navigationTitle(windowTitle) .toolbar { // Per HIG: "sidebar-toggle/back controls appear at the far leading // edge, followed by the view title" — this is that title, not