Created
October 6, 2025 09:55
-
-
Save umkl/e0427cc840758344f685ab0c8bdede51 to your computer and use it in GitHub Desktop.
toggle bg sounds macos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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