dotfiles/bin/play_error_sound.sh

12 lines
442 B
Bash
Raw Normal View History

2022-11-19 13:22:31 -07:00
#!/usr/bin/env bash
2022-09-06 23:34:19 -06:00
# Play MacOS system error sound: System Preferences -> Sound -> Sound Effects
2022-11-19 13:22:31 -07:00
# Plays sway error sound as well
2022-09-06 23:34:19 -06:00
if [[ $(uname) == 'Darwin' ]]; then
2022-11-19 13:22:31 -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 &
2022-09-06 23:34:19 -06:00
fi