fix(notifications): mute system notification for the viewed surface#562
Merged
sbertix merged 2 commits intoJul 2, 2026
Merged
Conversation
Derive isViewed (worktree selected, surface focused, window key and visible) in appendNotification, reuse it for the inbox isRead flag, and forward it through TerminalClient.Event.notificationReceived so AppFeature skips the banner and fallback sound for a surface the user is already watching. Gated by a new "Mute notifications for active surface" toggle (default on) under Settings > Notifications. Fixes supabitapp#558
8d9b255 to
80e7e74
Compare
Gate isViewedSurface on the tab's zoom-aware visible leaves so a focused pane hidden behind a split zoom no longer suppresses its notification. Cover the isViewedSurface composite directly (selected, focused, window key/visible, zoom-hidden, unsynced) and pin that a viewed surface skips both delivery channels. Sync window focus in the pre-existing focused-and- selected inbox test so it reflects the full viewed condition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #558
What
WorktreeTerminalState.appendNotificationnow derivesisViewed: the worktree is selected, the surface is the focused one of the selected tab, and the window is key and visible (lastWindowIsKey/lastWindowIsVisiblefromsyncFocus;isSelected()guards against stale window flags after switching worktrees). The same composite replaces the previousisReadderivation, which was missing the window-key check.onNotificationReceived→TerminalClient.Event.notificationReceived(isViewed:), andAppFeatureskips thesystemNotificationClient.send/notificationSoundClient.playeffects when the surface is viewed.GlobalSettings.muteNotificationsForActiveSurface, defaulttrue), applied symmetrically to the banner and the fallback sound. The toggle disables itself when both delivery channels are off, driven bySettingsFeature.State.hasActiveNotificationChannel.Untouched on purpose
worktreeNotificationReceivedaction still fires for every notification.SystemNotificationClient.willPresentkeeps forcing banners for the active app: a notification from a non-selected worktree must still show while Supacode is frontmost.Tests
AppFeatureSystemNotificationTests: viewed + mute-on skips the banner and the sound; viewed + mute-off fires both; existing cases updated for the new event arity.SettingsFeatureTests.hasActiveNotificationChannelReflectsDeliveryToggles: all four delivery-toggle combinations.AgentBusyStateTests: callback closures updated.