 		CoalescingQueue.standard.add(self, #selector(makeToolbarValidate))
 	}
 
+	@objc func sidebarSelectionDidChange(_ note: Notification) {
+		
+		let selectedObjects = selectedObjectsInSidebar()
+		guard selectedObjects?.count == 1 else {
+			currentFeedOrFolder = nil
+			return
+		}
+		
+		guard let displayNameProvider = selectedObjects?[0] as? DisplayNameProvider else {
+			currentFeedOrFolder = nil
+			return
+		}
+		
+		currentFeedOrFolder = displayNameProvider
+		
+	}
+	
 	@objc func unreadCountDidChange(_ note: Notification) {
-
-		if note.object is AccountManager {
-			unreadCount = AccountManager.shared.unreadCount
-		}
-	}
-
+		updateWindowTitleIfNecessary(note.object)
+	}
+	
+	@objc func displayNameDidChange(_ note: Notification) {
+		updateWindowTitleIfNecessary(note.object)
+	}
+
+	private func updateWindowTitleIfNecessary(_ object: Any?) {
+		
+		if let folder = currentFeedOrFolder as? Folder, let countNote = object as? Folder {
+			if folder == countNote {
+				updateWindowTitle()
+				return
+			}
+		}
+		
+		if let feed = currentFeedOrFolder as? Feed, let countNote = object as? Feed {
+			if feed == countNote {
+				updateWindowTitle()
+			}
+		}
+		
+	}
+	
 	// MARK: - Toolbar
 	
 	@objc func makeToolbarValidate() {


	func updateWindowTitle() {

		if unreadCount < 1 {
			window?.title = appDelegate.appName!
		}
		else if unreadCount > 0 {
			window?.title = "\(appDelegate.appName!) (\(unreadCount))"
		}
	}

	func saveSplitViewState() {

	private let windowAutosaveName = NSWindow.FrameAutosaveName(rawValue: "MainWindow")
	static var didPositionWindowOnFirstRun = false

	private var currentFeedOrFolder: DisplayNameProvider? = nil {
		didSet {
			updateWindowTitle()
		}
	}
	
	private var shareToolbarItem: NSToolbarItem? {
		return window?.toolbar?.existingItem(withIdentifier: .Share)
	}
