From 79b76fb5f4ce280a9233f0acab9106235d0f8dd2 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 8 Dec 2025 00:56:36 +0100 Subject: [PATCH] ui: drop default sound picker; use cli per-notification sound --- apps/macos/Sources/Clawdis/AppState.swift | 6 ------ apps/macos/Sources/Clawdis/GeneralSettings.swift | 11 ----------- apps/macos/Sources/Clawdis/XPCService.swift | 2 +- docs/clawdis-mac.md | 5 +++-- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/apps/macos/Sources/Clawdis/AppState.swift b/apps/macos/Sources/Clawdis/AppState.swift index a39f4b5d7..91ce13a16 100644 --- a/apps/macos/Sources/Clawdis/AppState.swift +++ b/apps/macos/Sources/Clawdis/AppState.swift @@ -14,10 +14,6 @@ final class AppState: ObservableObject { didSet { UserDefaults.standard.set(self.isPaused, forKey: pauseDefaultsKey) } } - @Published var defaultSound: String { - didSet { UserDefaults.standard.set(self.defaultSound, forKey: "clawdis.defaultSound") } - } - @Published var launchAtLogin: Bool { didSet { Task { AppStateStore.updateLaunchAtLogin(enabled: self.launchAtLogin) } } } @@ -130,7 +126,6 @@ final class AppState: ObservableObject { init() { self.isPaused = UserDefaults.standard.bool(forKey: pauseDefaultsKey) - self.defaultSound = UserDefaults.standard.string(forKey: "clawdis.defaultSound") ?? "" self.launchAtLogin = LaunchAgentManager.status() self.onboardingSeen = UserDefaults.standard.bool(forKey: "clawdis.onboardingSeen") self.debugPaneEnabled = UserDefaults.standard.bool(forKey: "clawdis.debugPaneEnabled") @@ -224,7 +219,6 @@ final class AppState: ObservableObject { enum AppStateStore { static let shared = AppState() static var isPausedFlag: Bool { UserDefaults.standard.bool(forKey: pauseDefaultsKey) } - static var defaultSound: String { UserDefaults.standard.string(forKey: "clawdis.defaultSound") ?? "" } static func updateLaunchAtLogin(enabled: Bool) { LaunchAgentManager.set(enabled: enabled, bundlePath: Bundle.main.bundlePath) diff --git a/apps/macos/Sources/Clawdis/GeneralSettings.swift b/apps/macos/Sources/Clawdis/GeneralSettings.swift index b11ef05b6..9275e3b10 100644 --- a/apps/macos/Sources/Clawdis/GeneralSettings.swift +++ b/apps/macos/Sources/Clawdis/GeneralSettings.swift @@ -48,17 +48,6 @@ var body: some View { title: "Enable debug tools", subtitle: "Show the Debug tab with development utilities.", binding: self.$state.debugPaneEnabled) - - LabeledContent("Default sound") { - Picker("Sound", selection: self.$state.defaultSound) { - Text("None").tag("") - Text("Glass").tag("Glass") - Text("Basso").tag("Basso") - Text("Ping").tag("Ping") - } - .labelsHidden() - .frame(width: 140) - } } Spacer(minLength: 12) diff --git a/apps/macos/Sources/Clawdis/XPCService.swift b/apps/macos/Sources/Clawdis/XPCService.swift index 290fea75a..f8f63bce7 100644 --- a/apps/macos/Sources/Clawdis/XPCService.swift +++ b/apps/macos/Sources/Clawdis/XPCService.swift @@ -37,7 +37,7 @@ final class ClawdisXPCService: NSObject, ClawdisXPCProtocol { switch request { case let .notify(title, body, sound): - let chosenSound: String = if let sound { sound } else { await MainActor.run { AppStateStore.defaultSound } } + let chosenSound = sound?.trimmingCharacters(in: .whitespacesAndNewlines) let ok = await notifier.send(title: title, body: body, sound: chosenSound) return ok ? Response(ok: true) : Response(ok: false, message: "notification not authorized") diff --git a/docs/clawdis-mac.md b/docs/clawdis-mac.md index 1ee216d39..cc3ab84a8 100644 --- a/docs/clawdis-mac.md +++ b/docs/clawdis-mac.md @@ -42,7 +42,7 @@ struct Response { ok: Bool; message?: String; payload?: Data } - MenuBarExtra icon only (LSUIElement; no Dock). - Menu items: Status, Permissions…, **Pause Clawdis** toggle (temporarily deny privileged actions/notifications without quitting), Quit. - Settings window (Trimmy-style tabs): - - General: launch at login toggle, default sound, logging verbosity. +- General: launch at login toggle and debug/visibility toggles (no per-user default sound; pass sounds per notification via CLI). - Permissions: live status + “Request” buttons for Notifications/Accessibility/Screen Recording; links to System Settings. - Debug (when enabled): PID/log links, restart/reveal app shortcuts, manual test notification. - About: version, links, license. @@ -50,7 +50,7 @@ struct Response { ok: Bool; message?: String; payload?: Data } - Onboarding (VibeTunnel-inspired): Welcome → What it does → Install CLI (shows `ln -s .../clawdis-mac /usr/local/bin`) → Permissions checklist with live status → Test notification → Done. Re-show when `welcomeVersion` bumps or CLI/app version mismatch. ## Built-in services -- NotificationManager: UNUserNotificationCenter primary; AppleScript `display notification` fallback; respects sound setting. +- NotificationManager: UNUserNotificationCenter primary; AppleScript `display notification` fallback; respects the `--sound` value on each request. - PermissionManager: checks/requests Notifications, Accessibility (AX), Screen Recording (capture probe); publishes changes for UI. - ScreenCaptureManager: window/display PNG capture; gated on permission. - ShellRunner: executes `Process` with timeout; rejects when `needsScreenRecording` and permission missing; returns stdout/stderr in payload. @@ -63,6 +63,7 @@ struct Response { ok: Bool; message?: String; payload?: Data } - `screenshot [--display-id N | --window-id N] [--out path]` - `run -- cmd args... [--cwd] [--env KEY=VAL] [--timeout 30] [--needs-screen-recording]` - `status` +- Sounds: supply any macOS alert name with `--sound` per notification; omit the flag to use the system default. There is no longer a persisted “default sound” in the app UI. - Internals: builds Request, connects via AsyncXPCConnection, prints Response as JSON to stdout. ## Integration with clawdis/Clawdis (Node/TS)