dotfiles/bin/play_error_sound.sh

12 lines
442 B
Bash
Raw Normal View History

2023-12-23 20:13:58 -07:00
#!/usr/bin/env bash
2023-12-23 20:13:47 -07:00
# Play MacOS system error sound: System Preferences -> Sound -> Sound Effects
2023-12-23 20:13:58 -07:00
# Plays sway error sound as well
2023-12-23 20:13:47 -07:00
if [[ $(uname) == 'Darwin' ]]; then
2023-12-23 20:13:58 -07:00
declare s="$(defaults read .GlobalPreferences.plist \
| awk '/sound.beep.sound"/ { gsub(/(.*= ")|(";)/, ""); print }')"
afplay "$s" &>/dev/null &
elif [[ -n ${SWAYSOCK+x} ]]; then
ffplay -nodisp -autoexit ~/.configs_pointer/sway/error_sound.mp3 &>/dev/null &
2023-12-23 20:13:47 -07:00
fi