Skip to content

Instantly share code, notes, and snippets.

@umkl
Created October 6, 2025 09:55
Show Gist options
  • Save umkl/e0427cc840758344f685ab0c8bdede51 to your computer and use it in GitHub Desktop.
Save umkl/e0427cc840758344f685ab0c8bdede51 to your computer and use it in GitHub Desktop.
toggle bg sounds macos
#!/bin/bash
# Check if background sounds is enabled
enabled=$(defaults read com.apple.ComfortSounds comfortSoundsEnabled 2>/dev/null)
if [[ "$enabled" == "1" ]]; then
# Disable background sounds
defaults write com.apple.ComfortSounds comfortSoundsEnabled -bool NO
launchctl kill SIGHUP gui/$(id -u)/com.apple.accessibility.heard
else
# Enable background sounds
defaults write com.apple.ComfortSounds comfortSoundsEnabled -bool YES
defaults write com.apple.ComfortSounds lastEnablementTimestamp $(date +%s)
launchctl kill SIGHUP gui/$(id -u)/com.apple.accessibility.heard
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment