X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=alarm;h=4b9639c92580c38099099441d9c2f953720450e3;hb=0807353e7ba81c381cff78b6165f6c725bbcd2ec;hp=61c61197d0a0489a670ff1b9e77d290b9c8f0dfb;hpb=06e21be610f2c792ec732bebacd0b35856200934;p=bin.git diff --git a/alarm b/alarm index 61c6119..4b9639c 100755 --- a/alarm +++ b/alarm @@ -6,12 +6,26 @@ fi; MPG321DEVICE="-o pulse" MUSIC='' MPG321OPTS="-n 300" +cmd_exists () { + if which "$1" >/dev/null 2>&1; then + return 0; + else + return 1; + fi; +} + +message() { + if cmd_exists "notify-send"; then + notify-send -t 4000 Alarm "your $SLEEP timer has expired"; + fi; +} + for plantasia in ~/media/{audio,music}/mort_garson/plantasia/01_plantasia.mp3 \ ~/media/jack2/Plantasia/01\ Plantasia.mp3; do if [ -e "${plantasia}" ]; then MUSIC="${plantasia}" - MPG321OPTS="-k 15 -n 224"; + MPG321OPTS="-k 15 -n 209"; fi; done; if [ -z "$MUSIC" ]; then @@ -22,4 +36,4 @@ if [ -z "$MUSIC" ]; then MUSIC="$(find ~/media/jack/ \( -type f -o -xtype f \) -iname '*.mp3' -print -quit)" fi; fi; -(sleep $SLEEP; mpg321 $MPG321DEVICE $MPG321OPTS "$MUSIC" >/dev/null 2>&1 ) & +(sleep $SLEEP; message; mpg321 $MPG321DEVICE $MPG321OPTS "$MUSIC" >/dev/null 2>&1 ) &