18 lines
390 B
Python
18 lines
390 B
Python
"""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()
|