dotwryn/scwrypts/lib/media/audio.module.zsh
2023-06-27 16:53:59 -06:00

39 lines
1.3 KiB
Bash

#####################################################################
DEPENDENCIES+=(
canberra-gtk-play
)
REQUIRED_ENV+=()
use desktop/notify --group dotwryn
#####################################################################
MEDIA__PLAY_SFX() {
local SFX_FILE
case $1 in
volume ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-message.oga ;;
mute ) SFX_FILE=$DESKTOP__SFX_PATH/smooth-dialog-warning.oga ;;
backlight ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-audio-volume-change.oga ;;
login ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-desktop-login.oga ;;
logout ) SFX_FILE=$DESKTOP__SFX_PATH/smooth-desktop-login.oga ;;
notify ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-complete.oga ;;
undock ) SFX_FILE=$DESKTOP__SFX_PATH/yaru-desktop-login.oga ;;
homedock ) SFX_FILE=$DESKTOP__SFX_PATH/homedock.oga ;;
gamedock ) SFX_FILE=$DESKTOP__SFX_PATH/gamedock.oga ;;
* ) SFX_FILE="$1"
;;
esac
[ -f $SFX_FILE ] \
&& STATUS "detected file '$SFX_FILE'" \
|| NOTIFY_FAIL 1 "unable to locate sfx file '$1'" \
;
STATUS 'starting playback'
canberra-gtk-play -f "$SFX_FILE" \
&& SUCCESS "finished output of '$SFX_FILE'" \
|| NOTIFY_FAIL 1 "something went wrong playing file '$SFX_FILE'"
}