From 7ecd408f8958382e755e3b269235cbcea0f8118b Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 12 Jun 2026 09:54:24 +0200 Subject: [PATCH] Pin search bar to right of macOS toolbar in list views Match the global Search view by pinning the searchable field and trailing buttons to the right edge on macOS 26 via a flexible ToolbarSpacer at .primaryAction. Applied to History, Bookmarks, Manage Channels, Downloads, Instance Browse, and PeerTube Explore. In History, the clear-history item moves from .automatic to .primaryAction so it groups with the other trailing controls. --- Yattee/Views/Downloads/DownloadsView.swift | 7 +++++++ Yattee/Views/Home/BookmarksListView.swift | 7 +++++++ Yattee/Views/Home/HistoryListView.swift | 9 ++++++++- Yattee/Views/Instances/InstanceBrowseView.swift | 7 +++++++ Yattee/Views/Settings/PeerTubeInstancesExploreView.swift | 7 +++++++ Yattee/Views/Subscriptions/ManageChannelsView.swift | 7 +++++++ 6 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Yattee/Views/Downloads/DownloadsView.swift b/Yattee/Views/Downloads/DownloadsView.swift index bdb1cb53..a6257f04 100644 --- a/Yattee/Views/Downloads/DownloadsView.swift +++ b/Yattee/Views/Downloads/DownloadsView.swift @@ -38,6 +38,13 @@ struct DownloadsView: View { .navigationTitle(String(localized: "downloads.title")) .toolbarTitleDisplayMode(.inlineLarge) .toolbar { + #if os(macOS) + // Pin the trailing group (search field + toolbar buttons) to the right edge, + // matching the global Search view. + if #available(macOS 26, *) { + ToolbarSpacer(.flexible, placement: .primaryAction) + } + #endif ToolbarItem(placement: .primaryAction) { if let settings = downloadSettings { sortAndGroupMenu(settings) diff --git a/Yattee/Views/Home/BookmarksListView.swift b/Yattee/Views/Home/BookmarksListView.swift index 2d1b088a..db3a9d3d 100644 --- a/Yattee/Views/Home/BookmarksListView.swift +++ b/Yattee/Views/Home/BookmarksListView.swift @@ -153,6 +153,13 @@ struct BookmarksListView: View { .toolbarTitleDisplayMode(.inlineLarge) .searchable(text: $searchText, prompt: Text(String(localized: "bookmarks.search.placeholder"))) .toolbar { + #if os(macOS) + // Pin the trailing group (search field + toolbar buttons) to the right edge, + // matching the global Search view. + if #available(macOS 26, *) { + ToolbarSpacer(.flexible, placement: .primaryAction) + } + #endif ToolbarItem(placement: .primaryAction) { Button { showViewOptions = true diff --git a/Yattee/Views/Home/HistoryListView.swift b/Yattee/Views/Home/HistoryListView.swift index 68da5e76..46e05657 100644 --- a/Yattee/Views/Home/HistoryListView.swift +++ b/Yattee/Views/Home/HistoryListView.swift @@ -167,6 +167,13 @@ struct HistoryListView: View { .toolbarTitleDisplayMode(.inlineLarge) .searchable(text: $searchText, prompt: Text(String(localized: "history.search.placeholder"))) .toolbar { + #if os(macOS) + // Pin the trailing group (search field + toolbar buttons) to the right edge, + // matching the global Search view. + if #available(macOS 26, *) { + ToolbarSpacer(.flexible, placement: .primaryAction) + } + #endif // View options button (always visible) ToolbarItem(placement: .primaryAction) { Button { @@ -184,7 +191,7 @@ struct HistoryListView: View { // Clear history menu (only when not empty) if !history.isEmpty { - ToolbarItem(placement: .automatic) { + ToolbarItem(placement: .primaryAction) { Menu { ForEach(ClearHistoryOption.allCases, id: \.self) { option in Button(role: .destructive) { diff --git a/Yattee/Views/Instances/InstanceBrowseView.swift b/Yattee/Views/Instances/InstanceBrowseView.swift index 8c8e8333..7480ebda 100644 --- a/Yattee/Views/Instances/InstanceBrowseView.swift +++ b/Yattee/Views/Instances/InstanceBrowseView.swift @@ -340,6 +340,13 @@ struct InstanceBrowseView: View { .navigationTitle(instance.displayName) .toolbarTitleDisplayMode(.inlineLarge) .toolbar { + #if os(macOS) + // Pin the trailing group (search field + toolbar buttons) to the right edge, + // matching the global Search view. + if #available(macOS 26, *) { + ToolbarSpacer(.flexible, placement: .primaryAction) + } + #endif ToolbarItem(placement: .primaryAction) { Button { showViewOptions = true diff --git a/Yattee/Views/Settings/PeerTubeInstancesExploreView.swift b/Yattee/Views/Settings/PeerTubeInstancesExploreView.swift index 12cca896..e02c7a99 100644 --- a/Yattee/Views/Settings/PeerTubeInstancesExploreView.swift +++ b/Yattee/Views/Settings/PeerTubeInstancesExploreView.swift @@ -224,6 +224,13 @@ struct PeerTubeInstancesExploreView: View { sheetCloseToolbarItem { dismiss() } #endif + #if os(macOS) + // Pin the trailing group (search field + toolbar buttons) to the right edge, + // matching the global Search view. + if #available(macOS 26, *) { + ToolbarSpacer(.flexible, placement: .primaryAction) + } + #endif ToolbarItem(placement: .primaryAction) { Button { showFiltersSheet = true diff --git a/Yattee/Views/Subscriptions/ManageChannelsView.swift b/Yattee/Views/Subscriptions/ManageChannelsView.swift index 35b4df01..35df1ae8 100644 --- a/Yattee/Views/Subscriptions/ManageChannelsView.swift +++ b/Yattee/Views/Subscriptions/ManageChannelsView.swift @@ -191,6 +191,13 @@ struct ManageChannelsView: View { .toolbarTitleDisplayMode(.inlineLarge) .searchable(text: $searchText, prompt: Text(String(localized: "channels.search.placeholder"))) .toolbar { + #if os(macOS) + // Pin the trailing group (search field + toolbar buttons) to the right edge, + // matching the global Search view. + if #available(macOS 26, *) { + ToolbarSpacer(.flexible, placement: .primaryAction) + } + #endif ToolbarItem(placement: .primaryAction) { Button { showViewOptions = true