From 514b90ac694f1a75818b4efa6b3a85920da2ec95 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 9 Dec 2025 03:39:50 +0100 Subject: [PATCH] VoiceWake: autoplay chime on selection --- apps/macos/Sources/Clawdis/VoiceWakeSettings.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/macos/Sources/Clawdis/VoiceWakeSettings.swift b/apps/macos/Sources/Clawdis/VoiceWakeSettings.swift index aebc779af..62dff76d4 100644 --- a/apps/macos/Sources/Clawdis/VoiceWakeSettings.swift +++ b/apps/macos/Sources/Clawdis/VoiceWakeSettings.swift @@ -234,11 +234,11 @@ struct VoiceWakeSettings: View { .frame(width: self.fieldLabelWidth, alignment: .leading) Menu { - Button("No Sound") { selection.wrappedValue = .none } + Button("No Sound") { self.selectChime(.none, binding: selection) } Divider() ForEach(VoiceWakeChimeCatalog.systemOptions, id: \.self) { option in Button(VoiceWakeChimeCatalog.displayName(for: option)) { - selection.wrappedValue = .system(name: option) + self.selectChime(.system(name: option), binding: selection) } } Divider() @@ -282,13 +282,20 @@ struct VoiceWakeSettings: View { options: [.withSecurityScope], includingResourceValuesForKeys: nil, relativeTo: nil) - selection.wrappedValue = .custom(displayName: url.lastPathComponent, bookmark: bookmark) + let chosen = VoiceWakeChime.custom(displayName: url.lastPathComponent, bookmark: bookmark) + selection.wrappedValue = chosen + VoiceWakeChimePlayer.play(chosen) } catch { // Ignore failures; user can retry. } } } + private func selectChime(_ chime: VoiceWakeChime, binding: Binding) { + binding.wrappedValue = chime + VoiceWakeChimePlayer.play(chime) + } + private func sanitizedTriggers() -> [String] { sanitizeVoiceWakeTriggers(self.state.swabbleTriggerWords) }