From 98b999050e1fcecd8720aa38f03bb6f6fa2c3795 Mon Sep 17 00:00:00 2001 From: William La Date: Sun, 1 Jan 2023 14:06:01 -0500 Subject: [PATCH] update to allow setting a default player and OS detection --- timer.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/timer.sh b/timer.sh index 967f428..930cc5f 100755 --- a/timer.sh +++ b/timer.sh @@ -1,5 +1,15 @@ #!/bin/bash +player="" #set custom player + +if [ "$player" == "" ] +then + case "$OSTYPE" in + darwin*) player=afplay ;; + *) player=aplay ;; #assume linux, use alsa + esac +fi + function args_to_scds { x_seconds=0 if [[ $2 == "h" ]]; then @@ -110,6 +120,6 @@ do ((i+=1)) echo -e "\t\t${BWHITE}Timer $i${NC} ($(date +"%T"))" if $play_audio ; then - mpv $audio_path --really-quiet > /dev/null 2>&1 & + $player $audio_path > /dev/null 2>&1 & fi done