Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3777d83
Add failing desktop notification settings test
Jun 26, 2026
306d4ef
Fix desktop notification permission settings row
Jun 26, 2026
8b5c288
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
Jun 29, 2026
71c057d
Retrigger Vercel checks
Jun 29, 2026
974de6b
Address notification settings review feedback
Jun 29, 2026
07781fe
Stabilize app host regression tests
Jun 29, 2026
2990e02
Address file explorer cancellation cleanup
Jun 29, 2026
3b65799
Fix Claude stream accumulator delta accounting
Jun 29, 2026
7f9d45f
Use revision guard for file explorer loads
Jun 29, 2026
972e886
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
Jun 29, 2026
08b736e
Stabilize app host appearance tests
Jun 29, 2026
7928b0f
Fix panel background test import boundary
Jun 29, 2026
8571f47
Update hook persistence expectations
Jun 29, 2026
e8a3ae5
Stabilize CLI integration process capture
Jun 29, 2026
7176c4c
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jun 30, 2026
0e3ca21
Cover BrowserPanel ghostty-background subscription via injected center
austinywang Jun 30, 2026
89d9c0e
Remove BrowserPanel test-only background seam
austinywang Jun 30, 2026
d3fdf04
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jul 2, 2026
d89f1be
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jul 2, 2026
8836294
Capture content revision before prefetch debounce
austinywang Jul 2, 2026
a24c9ed
Refresh Swift file length budget for prefetch revision capture
austinywang Jul 2, 2026
2f56dac
Make chrome/panel background tests independent oracles; cover provisi…
austinywang Jul 2, 2026
e7ae720
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jul 2, 2026
4b697f1
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jul 2, 2026
70d38ef
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jul 4, 2026
95c4b59
Merge origin/main into issue-5919-settings-desktop-notifications-row-…
austinywang Jul 27, 2026
a2ae99b
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jul 27, 2026
5eafea6
Make screenshot recovery test deterministic
austinywang Jul 27, 2026
d74fb67
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jul 27, 2026
ff63482
Merge remote-tracking branch 'origin/main' into issue-5919-settings-d…
austinywang Jul 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/swift-file-length-budget.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
# Reduce counts as files shrink. CI fails if tracked files exceed this budget.
34430 CLI/cmux.swift
17978 Sources/AppDelegate.swift
16487 Sources/ContentView.swift
16484 Sources/ContentView.swift
14232 Sources/TerminalController.swift
13071 Sources/Workspace.swift
12348 cmuxTests/AppDelegateShortcutRoutingTests.swift
12212 Sources/GhosttyTerminalView.swift
11671 Sources/Panels/BrowserPanel.swift
11675 Sources/Panels/BrowserPanel.swift
9497 cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
8032 Sources/Panels/BrowserPanelView.swift
8016 CLI/cmux_open.swift
7783 Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift
7404 cmuxTests/WorkspaceUnitTests.swift
7218 cmuxTests/WorkspaceRemoteConnectionTests.swift
6359 cmuxTests/SessionPersistenceTests.swift
6217 cmuxTests/GhosttyConfigTests.swift
6248 cmuxTests/GhosttyConfigTests.swift
6166 Sources/TabManager.swift
5915 cmuxTests/TerminalAndGhosttyTests.swift
5938 cmuxTests/TerminalAndGhosttyTests.swift
5809 Sources/TextBoxInput.swift
5573 cmuxTests/BrowserConfigTests.swift
5587 cmuxTests/BrowserConfigTests.swift
4487 Sources/Panels/FilePreviewPanel.swift
4483 Sources/cmuxApp.swift
4367 cmuxTests/BrowserPanelTests.swift
Expand Down Expand Up @@ -62,13 +62,13 @@
1560 cmuxTests/TextBoxMentionCompletionTests.swift
1500 cmuxUITests/MultiWindowNotificationsUITests.swift
1499 cmuxTests/OmnibarAndToolsTests.swift
1447 Sources/FileExplorerStore.swift
1433 Sources/RemoteTmuxControlConnection.swift
1420 cmuxTests/AppDelegateIssue2907RoutingTests.swift
1384 cmuxTests/KeyboardShortcutSettingsFileStoreStartupTests.swift
1380 cmuxUITests/MenuKeyEquivalentRoutingUITests.swift
1363 Sources/CMUXInstalledExtensionSidebarHostView.swift
1360 Sources/Feed/FeedButtonStyleDebugWindowController.swift
1322 Sources/FileExplorerStore.swift
1295 Packages/macOS/CmuxTerminalCore/Sources/CmuxTerminalCore/Config/GhosttyConfig.swift
1295 cmuxTests/MobileHostAuthorizationTests.swift
1290 cmuxTests/TextBoxSubmitActionTests.swift
Expand All @@ -83,7 +83,7 @@
1166 Sources/VaultAgentProcessScanner.swift
1147 cmuxTests/PiVaultAgentPersistenceTests.swift
1121 cmuxTests/AgentHibernationTests.swift
1110 Sources/AppDelegate+CmuxSSHURL.swift
1109 Sources/AppDelegate+CmuxSSHURL.swift
1093 cmuxUITests/BonsplitTabDragUITests.swift
1087 Packages/macOS/CmuxCommandPalette/Sources/CmuxCommandPalette/Search/CommandPaletteFuzzyMatcher.swift
1044 cmuxTests/WorkspaceGroupTests.swift
Expand All @@ -101,8 +101,8 @@
942 Packages/iOS/CmuxMobileShellUI/Tests/CmuxMobileShellUITests/WorkspaceMacSelectionTests.swift
937 Sources/TextBoxMentionIndexStore.swift
929 Sources/Panels/TerminalPanel.swift
928 Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/AppSection.swift
918 Sources/Panels/BrowserPopupWindowController.swift
908 Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/AppSection.swift
905 Sources/CmuxSSHURLRequest.swift
899 Sources/Panels/MarkdownWebRenderer.swift
885 cmuxTests/SidebarWorkspaceDropPlannerTests.swift
Expand Down Expand Up @@ -132,9 +132,9 @@
756 Sources/Panels/AgentSessionWebRendererCoordinator.swift
754 Sources/TerminalController+ControlWorkspaceContext.swift
752 cmuxUITests/CloseWorkspaceCmdDUITests.swift
750 Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceDetailView.swift
739 cmuxTests/CLICodexHookTimeoutRegressionTests.swift
738 Packages/macOS/CMUXProjectModel/Sources/CMUXProjectModel/XcodeProjectAdapter.swift
724 Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceDetailView.swift
718 Packages/Shared/CmuxAuthRuntime/Sources/CmuxAuthRuntime/Coordinator/AuthCoordinator.swift
716 Sources/TaskManagerSnapshot.swift
715 Sources/AppleScriptSupport.swift
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Observation

/// `@Observable` view-model for the host's live macOS notification permission state.
@MainActor
@Observable
final class DesktopNotificationAuthorizationModel {
/// The most recent authorization state supplied by the host.
private(set) var current: DesktopNotificationAuthorizationState = .unknown

@ObservationIgnored private let currentStatus: () -> DesktopNotificationAuthorizationState
@ObservationIgnored private let makeStream: () -> AsyncStream<DesktopNotificationAuthorizationState>
@ObservationIgnored private let refreshStatus: () -> Void
@ObservationIgnored private let driver = SettingReadDriver<DesktopNotificationAuthorizationState>()
@ObservationIgnored private var hasStarted = false

/// Creates a model bound to the host's desktop-notification authorization stream.
///
/// - Parameter hostActions: The host bridge that supplies the current state,
/// refreshes from `UNUserNotificationCenter`, and emits later changes.
convenience init(hostActions: SettingsHostActions) {
self.init(
currentStatus: { hostActions.desktopNotificationAuthorizationStatus() },
makeStream: { hostActions.desktopNotificationAuthorizationStatusUpdates() },
refreshStatus: { hostActions.refreshDesktopNotificationAuthorizationStatus() }
)
}

init(
currentStatus: @escaping () -> DesktopNotificationAuthorizationState,
makeStream: @escaping () -> AsyncStream<DesktopNotificationAuthorizationState>,
refreshStatus: @escaping () -> Void
) {
self.currentStatus = currentStatus
self.makeStream = makeStream
self.refreshStatus = refreshStatus
}

/// Starts live observation and asks the host to refresh the OS permission state.
func startObserving() {
current = currentStatus()
if !hasStarted {
hasStarted = true
driver.activate(makeStream) { [weak self] state in
self?.current = state
}
}
refreshStatus()
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ extension DefaultsValueModel: SettingObservationStarting {}
extension JSONValueModel: SettingObservationStarting {}
extension SecretValueModel: SettingObservationStarting {}
extension MobilePairingStatusModel: SettingObservationStarting {}
extension DesktopNotificationAuthorizationModel: SettingObservationStarting {}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ public protocol SettingsHostActions: AnyObject {
/// user can grant / revoke OS-level notification permission.
func openSystemNotificationSettings()

/// Returns the host's current macOS notification authorization state.
func desktopNotificationAuthorizationStatus() -> DesktopNotificationAuthorizationState

/// Emits a fresh authorization state when the host observes a macOS
/// notification permission change.
func desktopNotificationAuthorizationStatusUpdates() -> AsyncStream<DesktopNotificationAuthorizationState>

/// Asks the host to refresh macOS notification permission from
/// `UNUserNotificationCenter`.
func refreshDesktopNotificationAuthorizationStatus()

/// Restarts the cmux app. Used after the user changes the
/// language picker, which requires a full process restart.
func restartApp()
Expand Down Expand Up @@ -176,6 +187,17 @@ public extension SettingsHostActions {

func browserHistoryEntryCount() -> Int? { nil }

/// Default: unknown permission state, for previews and tests without a host.
func desktopNotificationAuthorizationStatus() -> DesktopNotificationAuthorizationState { .unknown }

/// Default: no live permission updates, for previews and tests without a host.
func desktopNotificationAuthorizationStatusUpdates() -> AsyncStream<DesktopNotificationAuthorizationState> {
AsyncStream { $0.finish() }
}

/// Default: no refresh hook, for previews and tests without a host.
func refreshDesktopNotificationAuthorizationStatus() {}

/// Default: no status, for hosts without a live mobile service (previews/tests).
func mobilePairingStatus() -> MobilePairingStatusSnapshot? { nil }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public struct AppSection: View {
@State private var showInMenuBar: DefaultsValueModel<Bool>
@State private var paneRing: DefaultsValueModel<Bool>
@State private var paneFlash: DefaultsValueModel<Bool>
@State private var desktopNotifications: DesktopNotificationAuthorizationModel
@State private var soundName: DefaultsValueModel<String>
@State private var soundCommand: DefaultsValueModel<String>
@State private var customSoundFile: DefaultsValueModel<String>
Expand Down Expand Up @@ -96,6 +97,7 @@ public struct AppSection: View {
_showInMenuBar = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.notifications.showInMenuBar))
_paneRing = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.notifications.unreadPaneRing))
_paneFlash = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.notifications.paneFlash))
_desktopNotifications = State(initialValue: DesktopNotificationAuthorizationModel(hostActions: hostActions))
_soundName = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.notifications.sound))
_soundCommand = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.notifications.command))
_customSoundFile = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.notifications.customSoundFilePath))
Expand Down Expand Up @@ -128,7 +130,7 @@ public struct AppSection: View {
mainCard
}
.task {
startSettingsObservation([language, appearance, appIcon, placement, inheritDir, minimalMode, keepWorkspaceOpen, firstClick, fileDrop, preferredEditor, openSupported, openMarkdown, globalFontMagnification, markdownFontSize, markdownFontFamily, markdownMaxWidth, canvasPaneGap, canvasSnapping, fileEditorWordWrap, iMessage, reorder, dockBadge, menuBarOnly, showInMenuBar, paneRing, paneFlash, soundName, soundCommand, customSoundFile, telemetry, confirmQuit, warnCloseTab, warnCloseX, hideCloseButton, renameSelects, paletteAllSurfaces])
startSettingsObservation([language, appearance, appIcon, placement, inheritDir, minimalMode, keepWorkspaceOpen, firstClick, fileDrop, preferredEditor, openSupported, openMarkdown, globalFontMagnification, markdownFontSize, markdownFontFamily, markdownMaxWidth, canvasPaneGap, canvasSnapping, fileEditorWordWrap, iMessage, reorder, dockBadge, menuBarOnly, showInMenuBar, paneRing, paneFlash, desktopNotifications, soundName, soundCommand, customSoundFile, telemetry, confirmQuit, warnCloseTab, warnCloseX, hideCloseButton, renameSelects, paletteAllSurfaces])
if languageAtAppear == nil { languageAtAppear = language.current }; if telemetryAtAppear == nil { telemetryAtAppear = telemetry.current }
}
}
Expand Down Expand Up @@ -558,36 +560,14 @@ public struct AppSection: View {
.controlSize(.small)
}

// Desktop Notifications — legacy renders this row
// unconditionally with a permission-state status text +
// one dynamic action button + Send Test. Without a host
// signal for the permission state, the package falls
// back to the .notDetermined baseline: subtitle "Desktop
// notifications are not enabled yet.", "Enable" action
// (which maps to requestNotificationAuthorization), and
// Send Test. Buttons disable when no host is wired.
// Desktop Notifications
SettingsCardDivider()
SettingsCardRow(
configurationReview: .action,
searchAnchorID: "setting:app:desktop-notifications",
String(localized: "settings.notifications.desktop", defaultValue: "Desktop Notifications"),
subtitle: String(localized: "settings.notifications.desktop.subtitle.notDetermined", defaultValue: "Desktop notifications are not enabled yet.")
) {
HStack(spacing: 6) {
Text(String(localized: "settings.notifications.desktop.status.unknown", defaultValue: "Permission unknown"))
.cmuxFont(size: 11, weight: .semibold)
.foregroundStyle(.secondary)
.frame(width: 98, alignment: .trailing)
Button(String(localized: "settings.notifications.desktop.action.enable", defaultValue: "Enable")) {
hostActions.requestNotificationAuthorization()
}
.controlSize(.small)
Button(String(localized: "settings.notifications.desktop.sendTest", defaultValue: "Send Test")) {
hostActions.sendTestNotification()
}
.controlSize(.small)
}
}
DesktopNotificationsSettingsRow(
state: desktopNotifications.current,
requestAuthorization: { hostActions.requestNotificationAuthorization() },
openSystemSettings: { hostActions.openSystemNotificationSettings() },
sendTest: { hostActions.sendTestNotification() }
)
SettingsCardDivider()

// Notification Sound — Picker over NSSound names with
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/// Host-provided macOS notification authorization state for the Settings UI.
public enum DesktopNotificationAuthorizationState: Equatable, Sendable {
/// The host has not reported a concrete permission state yet.
case unknown
/// macOS has not asked the user for permission yet.
case notDetermined
/// macOS allows cmux to deliver desktop notifications.
case authorized
/// macOS blocks cmux desktop notifications.
case denied
/// macOS allows quiet desktop notification delivery.
case provisional
/// macOS granted temporary notification delivery.
case ephemeral
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
enum DesktopNotificationPermissionAction: Equatable, Sendable {
case requestAuthorization
case openSystemSettings
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import Foundation

struct DesktopNotificationPermissionPresentation: Equatable, Sendable {
var statusLabel: DesktopNotificationPermissionStatusLabel
var subtitle: DesktopNotificationPermissionSubtitle?
var primaryAction: DesktopNotificationPermissionAction?
var sendTestEnabled: Bool

static func make(
for state: DesktopNotificationAuthorizationState
) -> DesktopNotificationPermissionPresentation {
switch state {
case .unknown:
return DesktopNotificationPermissionPresentation(
statusLabel: .unknown,
subtitle: nil,
primaryAction: nil,
sendTestEnabled: false
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
case .notDetermined:
return DesktopNotificationPermissionPresentation(
statusLabel: .notRequested,
subtitle: .notDetermined,
primaryAction: .requestAuthorization,
sendTestEnabled: false
)
Comment thread
austinywang marked this conversation as resolved.
Resolved
case .authorized:
return DesktopNotificationPermissionPresentation(
statusLabel: .allowed,
subtitle: .allowed,
primaryAction: .openSystemSettings,
sendTestEnabled: true
)
case .denied:
return DesktopNotificationPermissionPresentation(
statusLabel: .denied,
subtitle: .denied,
primaryAction: .openSystemSettings,
sendTestEnabled: false
)
Comment thread
austinywang marked this conversation as resolved.
Resolved
case .provisional:
return DesktopNotificationPermissionPresentation(
statusLabel: .deliverQuietly,
subtitle: .allowed,
primaryAction: .openSystemSettings,
sendTestEnabled: true
)
case .ephemeral:
return DesktopNotificationPermissionPresentation(
statusLabel: .temporary,
subtitle: .allowed,
primaryAction: .openSystemSettings,
sendTestEnabled: true
)
}
}

var statusText: String {
switch statusLabel {
case .unknown:
return String(localized: "settings.notifications.desktop.status.unknown", defaultValue: "Permission unknown")
case .notRequested:
return String(localized: "settings.notifications.desktop.status.notRequested", defaultValue: "Not Requested")
case .allowed:
return String(localized: "settings.notifications.desktop.status.allowed", defaultValue: "Allowed")
case .denied:
return String(localized: "settings.notifications.desktop.status.denied", defaultValue: "Denied")
case .deliverQuietly:
return String(localized: "settings.notifications.desktop.status.deliverQuietly", defaultValue: "Deliver Quietly")
case .temporary:
return String(localized: "settings.notifications.desktop.status.temporary", defaultValue: "Temporary")
}
}

var subtitleText: String? {
guard let subtitle else { return nil }
switch subtitle {
case .notDetermined:
return String(localized: "settings.notifications.desktop.subtitle.notDetermined", defaultValue: "Desktop notifications are not enabled yet.")
case .allowed:
return String(localized: "settings.notifications.desktop.subtitle.allowed", defaultValue: "Desktop notifications are enabled.")
case .denied:
return String(localized: "settings.notifications.desktop.subtitle.denied", defaultValue: "Desktop notifications are disabled in System Settings.")
}
}

var primaryActionTitle: String? {
guard let primaryAction else { return nil }
switch primaryAction {
case .requestAuthorization:
return String(localized: "settings.notifications.desktop.action.enable", defaultValue: "Enable")
case .openSystemSettings:
return String(localized: "settings.notifications.desktop.action.openSettings", defaultValue: "Open System Settings")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
enum DesktopNotificationPermissionStatusLabel: Equatable, Sendable {
Comment thread
austinywang marked this conversation as resolved.
Resolved
case unknown
case notRequested
case allowed
case denied
case deliverQuietly
case temporary
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enum DesktopNotificationPermissionSubtitle: Equatable, Sendable {
case notDetermined
case allowed
case denied
}
Loading
Loading