diff --git a/desktop/CHANGELOG.json b/desktop/CHANGELOG.json index 49a1be906ac..14764ab7627 100644 --- a/desktop/CHANGELOG.json +++ b/desktop/CHANGELOG.json @@ -1,5 +1,7 @@ { - "unreleased": [], + "unreleased": [ + "Fixed the floating bar staying visible after notifications when \"Show floating bar\" is turned off" + ], "releases": [ { "version": "0.11.459", diff --git a/desktop/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift b/desktop/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift index 23a5403fbf8..2f822a20e25 100644 --- a/desktop/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift +++ b/desktop/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift @@ -398,8 +398,10 @@ class FloatingControlBarWindow: NSPanel, NSWindowDelegate { FloatingControlBarManager.shared.flushQueuedNotificationsIfPossible() // If the user has the bar disabled, hide it completely after closing the - // AI conversation instead of leaving the compact pill visible. - if !FloatingControlBarManager.shared.isEnabled { + // AI conversation instead of leaving the compact pill visible — unless a + // queued notification was just flushed; hiding now would swallow it, and + // its dismissal re-hides the bar anyway. + if !FloatingControlBarManager.shared.isEnabled && self?.state.currentNotification == nil { self?.orderOut(nil) } } @@ -1447,11 +1449,19 @@ class FloatingControlBarManager { private func presentNotification(_ notification: FloatingBarNotification, in window: FloatingControlBarWindow) { persistNotificationMessageIfNeeded(notification) - if !window.isVisible { + // The flag must survive the whole notification chain: when a queued + // notification is presented the window is already visible from the + // temp-show, so resetting it here would skip the re-hide in + // dismissNotificationAndAdvanceQueue and leave the bar on screen + // forever with "Show floating bar" off (#6972). The bar can also be + // visible while disabled (e.g. a notification flushed right as an AI + // conversation closes), so any presentation with the bar disabled + // must arm the re-hide; dismissNotificationAndAdvanceQueue owns the reset. + if !window.isVisible || !isEnabled { notificationWasTemporarilyShown = true - window.orderFrontRegardless() - } else { - notificationWasTemporarilyShown = false + if !window.isVisible { + window.orderFrontRegardless() + } } window.showNotification(notification)