From a746736bf1e45f3d35f2b44df0c5426ededcd35f Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 21 Oct 2026 20:35:05 -0700 Subject: [PATCH] Add Refresh and Show/Hide Sidebar commands to status bar gear menu. --- Mac/AppDelegate.swift | 2 +- Mac/MainWindow/MainWindowController.swift | 17 ++++++++++++++++- .../Sources/Account/AccountManager.swift | 4 ++++ Shared/Localizable.xcstrings | 6 ++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index ce865fc8f..1873f817d 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -486,7 +486,7 @@ let appName = "NetNewsWire" let isDisplayingSheet = mainWindowController?.isDisplayingSheet ?? false if item.action == #selector(refreshAll(_:)) { - return !AccountManager.shared.refreshInProgress && !AccountManager.shared.activeAccounts.isEmpty + return AccountManager.shared.canRefresh } if item.action == #selector(importOPMLFromFile(_:)) { diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index acf9c4682..894067aa5 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -884,7 +884,22 @@ extension MainWindowController: DetailViewControllerDelegate { extension MainWindowController: MainWindowStatusBarViewDelegate { func statusBarViewGearMenu(_ statusBarView: MainWindowStatusBarView) -> NSMenu? { - sidebarViewController?.statusBarMenu() + guard let menu = sidebarViewController?.statusBarMenu() else { + return nil + } + + var index = 0 + if AccountManager.shared.canRefresh { + menu.insertItem(withTitle: NSLocalizedString("Refresh", comment: "Refresh"), action: #selector(AppDelegate.refreshAll(_:)), keyEquivalent: "", at: index) + index += 1 + } + + let isSidebarHidden = sidebarSplitViewItem?.isCollapsed ?? false + let sidebarTitle = isSidebarHidden ? NSLocalizedString("Show Sidebar", comment: "Command") : NSLocalizedString("Hide Sidebar", comment: "Command") + menu.insertItem(withTitle: sidebarTitle, action: #selector(NSSplitViewController.toggleSidebar(_:)), keyEquivalent: "", at: index) + menu.insertItem(NSMenuItem.separator(), at: index + 1) + + return menu } func statusBarView(_ statusBarView: MainWindowStatusBarView, moveSidebarDividerTo position: CGFloat) { diff --git a/Modules/Account/Sources/Account/AccountManager.swift b/Modules/Account/Sources/Account/AccountManager.swift index ffb3d8337..cedffe546 100644 --- a/Modules/Account/Sources/Account/AccountManager.swift +++ b/Modules/Account/Sources/Account/AccountManager.swift @@ -132,6 +132,10 @@ import ActivityLog return false } + public var canRefresh: Bool { + !refreshInProgress && !activeAccounts.isEmpty + } + private var isActive = false public init() { diff --git a/Shared/Localizable.xcstrings b/Shared/Localizable.xcstrings index d180390c7..9eed59c8c 100644 --- a/Shared/Localizable.xcstrings +++ b/Shared/Localizable.xcstrings @@ -704,6 +704,9 @@ "Hide Read Feeds" : { "comment" : "Command" }, + "Hide Sidebar" : { + "comment" : "Command" + }, "Hide Status Bar" : { "comment" : "Command" }, @@ -1215,6 +1218,9 @@ "Show Reader View" : { "comment" : "Show Reader View" }, + "Show Sidebar" : { + "comment" : "Command" + }, "Show Status Bar" : { "comment" : "Command" },