Browse Source

fix(mac): remove all sounds and make mac app operation 100% silent

main
Ali Alavi 1 day ago
parent
commit
fef9d95916
  1. 16
      mac/src/AppDelegate.swift

16
mac/src/AppDelegate.swift

@ -15,9 +15,8 @@ public final class AppDelegate: NSObject, NSApplicationDelegate {
private var remoteListener: NWListener?
public func applicationDidFinishLaunching(_ notification: Notification) {
if UserDefaults.standard.object(forKey: "SonioxPlaySounds") == nil {
UserDefaults.standard.set(true, forKey: "SonioxPlaySounds")
}
// Completely silent operation by default
UserDefaults.standard.set(false, forKey: "SonioxPlaySounds")
statusBarController = StatusBarController()
statusBarController.onToggleRecording = { [weak self] in
@ -63,8 +62,7 @@ public final class AppDelegate: NSObject, NSApplicationDelegate {
// Connect to Linux Persistent Gateway (via local tunnel 18999 -> 8999)
RelayClient.shared.onRemoteUpdateReceived = { [weak self] text, cursor, isFullReplace in
guard let self = self else { return }
print("AppDelegate: 📥 Clean Remote Input Update: '\(text.prefix(30))...' (replace: \(isFullReplace))")
self.playSystemSound(name: "Tink")
print("AppDelegate: 📥 Clean Remote Input Update (Silent): '\(text.prefix(30))...' (replace: \(isFullReplace))")
HUDOverlayController.shared.show(state: .success(text: text))
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: cursor, isFullReplace: isFullReplace)
}
@ -115,7 +113,6 @@ public final class AppDelegate: NSObject, NSApplicationDelegate {
let text = json["text"] as? String {
DispatchQueue.main.async {
self.playSystemSound(name: "Tink")
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: nil, isFullReplace: true)
}
}
@ -152,7 +149,6 @@ public final class AppDelegate: NSObject, NSApplicationDelegate {
guard !audioRecorder.isRecording, !isBusyFinalizing else { return }
latestPartialText = nil
playSystemSound(name: "Blow")
let session = SonioxSessionPool.shared.acquireSession()
self.activeSession = session
@ -171,7 +167,6 @@ public final class AppDelegate: NSObject, NSApplicationDelegate {
switch result {
case .success(let text):
self.playSystemSound(name: "Hero")
FocusedInputSync.shared.applyRemoteUpdate(text: text, cursor: nil, isFullReplace: false)
case .failure(let error):
print("Soniox error:", error)
@ -206,9 +201,4 @@ public final class AppDelegate: NSObject, NSApplicationDelegate {
session.finalizeStream()
}
private func playSystemSound(name: String) {
guard UserDefaults.standard.bool(forKey: "SonioxPlaySounds") else { return }
NSSound(named: name)?.play()
}
}
Loading…
Cancel
Save