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