Last active
February 15, 2021 05:12
-
-
Save ssstonebraker/fb808b27a688cacabcaca60289f12a59 to your computer and use it in GitHub Desktop.
hue.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Steve Stonebraker | |
# Date: 11/16/2020 | |
# brakertech.com | |
WHOAMI=$(whoami) | |
path_phe=/Users/"$WHOAMI"/Library/cron/philips-hue-experiments | |
path_log="$PWD"/log/hue.log | |
path_npm=$(which npm) | |
# initialize log | |
mkdir -p log | |
touch "$path_log" | |
# Import API Key | |
# File should contain | |
# PHILIPS_HUE_USERNAME="<insert API KEY HERE>" | |
. /Users/"$WHOAMI"/.hue | |
# Import Path info | |
. ~/.bash_profile | |
# log argument passed | |
function log { | |
currtimestamp=`date "+%Y-%m-%d--%H-%M"` | |
echo "$currtimestamp: $1" >> $path_log | |
} | |
function lightGreen { | |
log "green" | |
cd "$path_phe" && "$path_npm" run set-color -- "#42f581" >> "$path_log" | |
exit 0 | |
} | |
function lightRed { | |
log "red" | |
cd "$path_phe" && "$path_npm" run set-color -- "d50000" >> "$path_log" | |
exit 0 | |
} | |
# Check if in meeting | |
if pgrep -x "GoToMeeting" &> /dev/null 2>&1; then | |
lightRed | |
elif pgrep -x "zoom.us" &> /dev/null 2>&1; then | |
lightRed | |
elif pgrep -x "Teams" &> /dev/null 2>&1; then | |
lightRed | |
elif pgrep -x "Webex Teams" &> /dev/null 2>&1; then | |
lightRed | |
else | |
lightGreen | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment