Skip to content

Commit

Permalink
#19, internet checking solution looks as if it is working.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDimmitt committed Feb 5, 2018
1 parent 0a32ca1 commit e332c6f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ test_date() {
case $(echo $num_lines) in
[0-1])
date +%s >> $DIR/.timestamp.txt
`/System/Library/Frameworks/ScreenSaver.framework/Resources/./ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background`;
if curl --silent --head https://github.com/michaeldimmitt/aerial_desktop;
then `/System/Library/Frameworks/ScreenSaver.framework/Resources/./ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background`;# echo Internet status: OK;
else osascript -e 'display notification "Please connect your computer to internet." with title "Aerial Desktop"'# echo Internet status: ERROR;
fi | tail -n 1
;;
[2])
old_time=`cat $DIR/.timestamp.txt`;
Expand All @@ -25,11 +28,18 @@ test_date() {
else
sed -i '' '1d' $DIR/.timestamp.txt;
date +%s >> $DIR/.timestamp.txt;
`/System/Library/Frameworks/ScreenSaver.framework/Resources/./ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background`;
if curl --silent --head https://github.com/michaeldimmitt/aerial_desktop;
then `/System/Library/Frameworks/ScreenSaver.framework/Resources/./ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background`;# echo Internet status: OK;
else osascript -e 'display notification "Please connect your computer to internet." with title "Aerial Desktop"'# echo Internet status: ERROR;
fi | tail -n 1
fi
;;
*) say "should never happen let me reset!";
rm $DIR/.timestamp.txt;`/System/Library/Frameworks/ScreenSaver.framework/Resources/./ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background`
rm $DIR/.timestamp.txt;
if curl --silent --head https://github.com/michaeldimmitt/aerial_desktop;
then `/System/Library/Frameworks/ScreenSaver.framework/Resources/./ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background`;# echo Internet status: OK;
else osascript -e 'display notification "Please connect your computer to internet." with title "Aerial Desktop"'# echo Internet status: ERROR;
fi | tail -n 1
;;
esac
}
Expand Down
23 changes: 16 additions & 7 deletions .hide/app/install/battery_check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash

# gather information to be able to run scripts from this file location.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# say $DIR
# end gather information.

# find out if charging
result=$(ioreg -l | grep IsCharging | cut -d " " -f 19;)
echo $result
Expand All @@ -21,16 +27,16 @@ else
fi
# end check battery to acceptance criteria.

# gather information to be able to run scripts from this file location.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# say $DIR
# end gather information.

# perform actions based on computer's charged state.
if [ "$result" == "Yes" ] ; then
# echo Charging;
if curl --silent --head https://github.com/michaeldimmitt/aerial_desktop;
then $DIR/./3_install_launch_agent.sh# echo Internet status: OK;
else osascript -e 'display notification "Please connect your computer to internet." with title "Aerial Desktop"'# echo Internet status: ERROR;
fi | tail -n 1

# osascript -e 'display notification "Since Computer is Charging, program ok." with title "Aerial Desktop"'
$DIR/./3_install_launch_agent.sh

elif [ "$result" == "No" ] ; then
echo Not Charging;
if (( $(echo "$percentage < $battery_threshold" | bc -l) )) ; then
Expand All @@ -40,7 +46,10 @@ elif [ "$result" == "No" ] ; then
else
# echo but at an acceptable battery level.
# osascript -e 'display notification "Computer not charging and but at an acceptable battery level, program ok." with title "Aerial Desktop"'
$DIR/./3_install_launch_agent.sh
if curl --silent --head https://github.com/michaeldimmitt/aerial_desktop;
then $DIR/./3_install_launch_agent.sh# echo Internet status: OK;
else osascript -e 'display notification "Please connect your computer to internet." with title "Aerial Desktop"'# echo Internet status: ERROR;
fi | tail -n 1
fi
else
osascript -e 'display notification " something went wrong, contact michael; did some bad programming." with title "Aerial Desktop"'
Expand Down

0 comments on commit e332c6f

Please sign in to comment.