tdisable notification when not at work - exercise_time - announce workout exercises with notifications and speech synth
 (HTM) git clone git://src.adamsgaard.dk/exercise_time
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 42e9b291df03ea4159e56aced53b3d8688c5cf15
 (DIR) parent 8c7abf57713fe7a4c9cf5234451633f7082d4248
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Sat,  4 Apr 2015 11:58:03 +0200
       
       disable notification when not at work
       
       Diffstat:
         M exercise_time.sh                    |      11 ++++++++---
       
       1 file changed, 8 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/exercise_time.sh b/exercise_time.sh
       t@@ -41,9 +41,12 @@ for ((i=0; i<$1; i++)); do
        
            announcement="It's exercise time! $2"
        
       -    # Send message to notification daemon
       -    if command -v notify-send &>/dev/null; then
       -        notify-send "$announcement"
       +    # Send message to notification daemon if computer is plugged in at my office
       +    # desk
       +    if [[ "$(ifconfig | grep 10.17.8)" ]]; then
       +        if command -v notify-send &>/dev/null; then
       +            notify-send "$announcement"
       +        fi
            fi
        
            # Use speech synthesis if the computer is plugged in at my office desk
       t@@ -64,6 +67,7 @@ for ((i=0; i<$1; i++)); do
                        if command -v mpc &>/dev/null; then
                            if [[ "$(mpc | grep playing)" ]]; then
                                mpc pause &> /dev/null
       +                        sleep 2
                                playingmusic=1
                            fi
                        fi
       t@@ -72,6 +76,7 @@ for ((i=0; i<$1; i++)); do
                        fi
                        if command -v mpc &>/dev/null; then
                            if [[ $playingmusic -eq 1 ]]; then
       +                        sleep 2
                                mpc play &> /dev/null
                            fi
                        fi