Skip to content

feat: add notification sound option for corrections #36

@chernistry

Description

@chernistry

Summary

Add an optional subtle audio notification when RightLayout performs a correction. This provides immediate feedback that a correction occurred, which is especially important for accessibility — users who cannot easily see the menu bar indicator need an alternative feedback channel.

Why This Matters

  • Accessibility: Users with visual impairments need auditory feedback
  • Attention: When focused on content (not the menu bar), users may miss visual correction indicators
  • Confidence: Audio confirmation helps users trust that the tool is working
  • Customization: Power users want to tune their experience

Proposed Implementation

Settings

Add to preferences:

  • Correction sound: On / Off (default: Off)
  • Sound type: System sound picker (Tink, Pop, Frog, Glass, etc.) or "Custom..."
  • Volume: Slider (0-100%, independent of system volume — or tied to system alert volume)

Sound Selection

Built-in options (macOS system sounds):

  • Tink — subtle, professional (recommended default when enabled)
  • Pop — slightly more noticeable
  • Glass — traditional macOS alert
  • Frog — playful
  • Custom sound file (.aiff or .wav)

Implementation

import AppKit

// Play system sound
NSSound(named: "Tink")?.play()

// Or use AudioServicesPlaySystemSound for even lighter weight
import AudioToolbox
AudioServicesPlaySystemSound(1104) // Tink system sound ID

Where to trigger

File: RightLayout/Sources/Engine/EventMonitor.swift or correction handler

After a successful correction:

  1. Check if sound is enabled in preferences
  2. Play the selected sound
  3. Do NOT play sound if correction was undone (to avoid double-feedback)

Rate limiting

  • If multiple corrections happen rapidly (e.g., correcting a sentence), don't play sound for every word
  • Debounce: play at most once per 500ms
  • Or: play once per correction batch (if multiple words are corrected together)

Settings UI

File: RightLayout/Sources/UI/SettingsView.swift

Add a "Sound" section to preferences:

[ ] Play sound on correction
  Sound: [Tink ▼]
  [Preview]  — button to hear the selected sound

Accessibility Considerations

  • Sound should complement, not replace, visual indicators
  • Consider VoiceOver announcement as an alternative: "Layout corrected to Russian"
  • Respect macOS "Play user interface sound effects" system preference
  • Consider haptic feedback on MacBooks with Force Touch trackpad (nice to have)

Test Cases

  • Sound plays on correction when enabled
  • No sound when disabled
  • Sound selection persists across app restarts
  • Preview button plays the selected sound
  • Rate limiting prevents rapid-fire sounds
  • Respects system "Do Not Disturb" / Focus mode
  • Custom sound file can be loaded

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions