Skip to content

Commit

Permalink
Added airplane mode options for bluetooth and wifi
Browse files Browse the repository at this point in the history
  • Loading branch information
pszaro committed Jan 16, 2018
1 parent de1a9e4 commit 2607b87
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ if [[ "$function" == "list" || "$function" == "help" || "$function" == "" ]]; th
printf "${LIGHTBLUE}go smallspacedock${GRAY} : Create Small Space In Dock\n"
printf "${LIGHTBLUE}go turnindexingoff${GRAY} : Turn Indexing Off\n"
printf "${LIGHTBLUE}go turnindexingon${GRAY} : Turn Indexing On\n"
printf "${LIGHTBLUE}go airplane-mode:status${GRAY} : Check Airplane Status\n"
printf "${LIGHTBLUE}go airplane-mode:on${GRAY} : Enable Airplane Mode\n"
printf "${LIGHTBLUE}go airplane-mode:off${GRAY} : Disable Airplane Mode\n"


printf "\n${WHITEBOLD}Time Machine: (go list:tm) \n"
Expand Down Expand Up @@ -273,6 +276,9 @@ elif [ "$function" == "list:general" ]; then
printf "${LIGHTBLUE}go smallspacedock${GRAY} : Create Small Space In Dock\n"
printf "${LIGHTBLUE}go turnindexingoff${GRAY} : Turn Indexing Off\n"
printf "${LIGHTBLUE}go turnindexingon${GRAY} : Turn Indexing On\n"
printf "${LIGHTBLUE}go airplane-mode:status${GRAY} : Check Airplane Status\n"
printf "${LIGHTBLUE}go airplane-mode:on${GRAY} : Enable Airplane Mode\n"
printf "${LIGHTBLUE}go airplane-mode:off${GRAY} : Disable Airplane Mode\n"
printf "${LIGHTBLUE}go tmenable${GRAY} : Enable Local Time Machine Backups\n"
printf "${LIGHTBLUE}go tmdisable${GRAY} : Disable Local Time Machine Backups\n"
printf "${LIGHTBLUE}go tmlatest${GRAY} : Display Latest Time Machine Backup\n"
Expand Down Expand Up @@ -1214,19 +1220,28 @@ elif [ "$function" == "turnindexingon" ]; then
echo "Turning Spotlight Indexing On...\n"
sudo mdutil -a -i on

# TODO: Working on airplane mode (disable wi-fi and bluetooth)
elif [ "$function" == "airplane-mode:status" ]; then
echo "Checking WiFi and Bluetooth status...\n"
echo
echo " WiFi Status: "
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
echo
echo " Bluetooth Status: "
defaults read /Library/Preferences/com.apple.Bluetooth ControllerPowerState | awk '{ if($1 != 0) {print "Bluetooth: ON"} else { print "Bluetooth: OFF" } }'
elif [ "$function" == "airplane-mode:on" ]; then
echo "Enabling airplane mode...\n"
# networksetup -setairportpower airport off
# networksetup -setairportpower en0 off
# networksetup -setairportpower en1 off
# launchctl unload -w /System/Library/LaunchDaemons/com.apple.blued.plist # Switch bluetooth off
networksetup -setairportpower airport off
networksetup -setairportpower en0 off
networksetup -setairportpower en1 off
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0 && \
sudo killall -HUP blued
elif [ "$function" == "airplane-mode:off" ]; then
echo "Disabling airplane mode...\n"
# networksetup -setairportpower airport on
# networksetup -setairportpower en0 on
# networksetup -setairportpower en1 on
# launchctl load -wF /System/Library/LaunchDaemons/com.apple.blued.plist # Switch bluetooth on
networksetup -setairportpower airport on
networksetup -setairportpower en0 on
networksetup -setairportpower en1 on
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 1 && \
sudo killall -HUP blued


#--------------------------------------------------------------------
Expand Down

0 comments on commit 2607b87

Please sign in to comment.