feat: add system sound alert module
Made-with: Cursor
This commit is contained in:
17
src/cursor_flasher/sound.py
Normal file
17
src/cursor_flasher/sound.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""System sound playback."""
|
||||
from Cocoa import NSSound
|
||||
|
||||
from cursor_flasher.config import Config
|
||||
|
||||
|
||||
def play_alert(config: Config) -> None:
|
||||
"""Play the configured alert sound if enabled."""
|
||||
if not config.sound_enabled:
|
||||
return
|
||||
|
||||
sound = NSSound.soundNamed_(config.sound_name)
|
||||
if sound is None:
|
||||
return
|
||||
|
||||
sound.setVolume_(config.sound_volume)
|
||||
sound.play()
|
||||
Reference in New Issue
Block a user