Skip to content

Instantly share code, notes, and snippets.

@realytcracker
Created July 10, 2020 19:27
Show Gist options
  • Save realytcracker/8d0fccda41880c4edad07ed0c726929f to your computer and use it in GitHub Desktop.
Save realytcracker/8d0fccda41880c4edad07ed0c726929f to your computer and use it in GitHub Desktop.
#!/bin/bash
# quickly turn handoff and airplay on or off
# usage: ./handplay.sh [on | off]
if [ "$1" == "off" ]; then
defaults write com.apple.NetworkBrowser DisableAirDrop -bool yes
defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityAdvertisingAllowed -bool no
defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityReceivingAllowed -bool no
echo "handoff and airplay are off."
elif [ "$1" == "on" ]; then
defaults write com.apple.NetworkBrowser DisableAirDrop -bool no
defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityAdvertisingAllowed -bool yes
defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityReceivingAllowed -bool yes
echo "handoff and airplay are on."
else
echo "usage: $0 [on | off]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment