For the life of me I can never remember where this sits in the settings, all I know is that it irritates me constantly 🙂
So to turn off handoff, run the script below:
# Turn off Handoff
defaults write ~/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist ActivityAdvertisingAllowed -bool no
defaults write ~/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist ActivityReceivingAllowed -bool no
# Restart sharingd
killall sharingd