ui: drop default sound picker; use cli per-notification sound

This commit is contained in:
Peter Steinberger
2025-12-08 00:56:36 +01:00
parent 42012389c4
commit 79b76fb5f4
4 changed files with 4 additions and 20 deletions

View File

@@ -14,10 +14,6 @@ final class AppState: ObservableObject {
didSet { UserDefaults.standard.set(self.isPaused, forKey: pauseDefaultsKey) } 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 { @Published var launchAtLogin: Bool {
didSet { Task { AppStateStore.updateLaunchAtLogin(enabled: self.launchAtLogin) } } didSet { Task { AppStateStore.updateLaunchAtLogin(enabled: self.launchAtLogin) } }
} }
@@ -130,7 +126,6 @@ final class AppState: ObservableObject {
init() { init() {
self.isPaused = UserDefaults.standard.bool(forKey: pauseDefaultsKey) self.isPaused = UserDefaults.standard.bool(forKey: pauseDefaultsKey)
self.defaultSound = UserDefaults.standard.string(forKey: "clawdis.defaultSound") ?? ""
self.launchAtLogin = LaunchAgentManager.status() self.launchAtLogin = LaunchAgentManager.status()
self.onboardingSeen = UserDefaults.standard.bool(forKey: "clawdis.onboardingSeen") self.onboardingSeen = UserDefaults.standard.bool(forKey: "clawdis.onboardingSeen")
self.debugPaneEnabled = UserDefaults.standard.bool(forKey: "clawdis.debugPaneEnabled") self.debugPaneEnabled = UserDefaults.standard.bool(forKey: "clawdis.debugPaneEnabled")
@@ -224,7 +219,6 @@ final class AppState: ObservableObject {
enum AppStateStore { enum AppStateStore {
static let shared = AppState() static let shared = AppState()
static var isPausedFlag: Bool { UserDefaults.standard.bool(forKey: pauseDefaultsKey) } static var isPausedFlag: Bool { UserDefaults.standard.bool(forKey: pauseDefaultsKey) }
static var defaultSound: String { UserDefaults.standard.string(forKey: "clawdis.defaultSound") ?? "" }
static func updateLaunchAtLogin(enabled: Bool) { static func updateLaunchAtLogin(enabled: Bool) {
LaunchAgentManager.set(enabled: enabled, bundlePath: Bundle.main.bundlePath) LaunchAgentManager.set(enabled: enabled, bundlePath: Bundle.main.bundlePath)

View File

@@ -48,17 +48,6 @@ var body: some View {
title: "Enable debug tools", title: "Enable debug tools",
subtitle: "Show the Debug tab with development utilities.", subtitle: "Show the Debug tab with development utilities.",
binding: self.$state.debugPaneEnabled) 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) Spacer(minLength: 12)

View File

@@ -37,7 +37,7 @@ final class ClawdisXPCService: NSObject, ClawdisXPCProtocol {
switch request { switch request {
case let .notify(title, body, sound): 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) let ok = await notifier.send(title: title, body: body, sound: chosenSound)
return ok ? Response(ok: true) : Response(ok: false, message: "notification not authorized") return ok ? Response(ok: true) : Response(ok: false, message: "notification not authorized")

View File

@@ -42,7 +42,7 @@ struct Response { ok: Bool; message?: String; payload?: Data }
- MenuBarExtra icon only (LSUIElement; no Dock). - MenuBarExtra icon only (LSUIElement; no Dock).
- Menu items: Status, Permissions…, **Pause Clawdis** toggle (temporarily deny privileged actions/notifications without quitting), Quit. - Menu items: Status, Permissions…, **Pause Clawdis** toggle (temporarily deny privileged actions/notifications without quitting), Quit.
- Settings window (Trimmy-style tabs): - 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. - 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. - Debug (when enabled): PID/log links, restart/reveal app shortcuts, manual test notification.
- About: version, links, license. - 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. - 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 ## 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. - PermissionManager: checks/requests Notifications, Accessibility (AX), Screen Recording (capture probe); publishes changes for UI.
- ScreenCaptureManager: window/display PNG capture; gated on permission. - ScreenCaptureManager: window/display PNG capture; gated on permission.
- ShellRunner: executes `Process` with timeout; rejects when `needsScreenRecording` and permission missing; returns stdout/stderr in payload. - 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]` - `screenshot [--display-id N | --window-id N] [--out path]`
- `run -- cmd args... [--cwd] [--env KEY=VAL] [--timeout 30] [--needs-screen-recording]` - `run -- cmd args... [--cwd] [--env KEY=VAL] [--timeout 30] [--needs-screen-recording]`
- `status` - `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. - Internals: builds Request, connects via AsyncXPCConnection, prints Response as JSON to stdout.
## Integration with clawdis/Clawdis (Node/TS) ## Integration with clawdis/Clawdis (Node/TS)