Respect unread count display setting in window title.

This commit is contained in:
Brent Simmons committed 2026-10-06 10:58:20 -07:00
1 parent 88c54fc3a0
commit 29f5b083c6
1 file changed
+9
@@ -111,6 +111,7 @@ final class MainWindowController: NSWindowController, NSUserInterfaceValidations
NotificationCenter.default.addObserver(self, selector: #selector(refreshProgressDidChange(_:)), name: .progressInfoDidChange, object: CombinedRefreshProgress.shared)
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleUnreadCountDisplaySettingDidChange(_:)), name: .unreadCountDisplaySettingDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(articleThemeNamesDidChangeNotification(_:)), name: .ArticleThemeNamesDidChangeNotification, object: nil)
@@ -198,6 +199,10 @@ final class MainWindowController: NSWindowController, NSUserInterfaceValidations
CoalescingQueue.standard.add(self, #selector(coalescedUpdateWindowTitle))
}
@objc func handleUnreadCountDisplaySettingDidChange(_ notification: Notification) {
updateWindowTitle()
}
@objc func coalescedUpdateWindowTitle() {
updateWindowTitle()
}
@@ -1657,6 +1662,10 @@ private extension MainWindowController {
}
func setSubtitle(_ count: Int) {
guard AppDefaults.shared.unreadCountDisplay == .count else {
window?.subtitle = ""
return
}
let localizedLabel = NSLocalizedString("%d unread", comment: "Unread")
let formattedLabel = NSString.localizedStringWithFormat(localizedLabel as NSString, count)
window?.subtitle = formattedLabel as String