scwrypts v3 refactor
This commit is contained in:
38
scwrypts/lib/media/audio.module.zsh
Normal file
38
scwrypts/lib/media/audio.module.zsh
Normal file
@@ -0,0 +1,38 @@
|
||||
#####################################################################
|
||||
|
||||
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'"
|
||||
}
|
Reference in New Issue
Block a user