如何在 macOS 上的终端中切换 Handoff(连续性)?

如何在 macOS 上的终端中切换 Handoff(连续性)?

有没有办法从命令行启用/禁用 Handoff 设置?

目前,我正在使用 macOS Mojave 10.14.3,我知道我可以通过前往“设置”>“通用”>“允许切换”来切换它 - 但正在寻找另一种方法。

在设置中切换交接

答案1

以下命令可以关闭 Handoff:

sudo -u $(whoami) defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityAdvertisingAllowed -bool no
sudo -u $(whoami) defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityReceivingAllowed -bool no

再次打开:

sudo -u $(whoami) defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityAdvertisingAllowed -bool yes
sudo -u $(whoami) defaults write "$HOME/Library/Preferences/ByHost/com.apple.coreservices.useractivityd.plist" ActivityReceivingAllowed -bool yes

来源:jamf.com– 请注意,我尚未验证这些命令,但 OP 声称它们正在运行。

答案2

@slhck 的回答可以简化为:

在:

defaults -currentHost write com.apple.coreservices.useractivityd ActivityAdvertisingAllowed -bool yes
defaults -currentHost write com.apple.coreservices.useractivityd ActivityReceivingAllowed -bool yes

离开:

defaults -currentHost write com.apple.coreservices.useractivityd ActivityAdvertisingAllowed -bool no
defaults -currentHost write com.apple.coreservices.useractivityd ActivityReceivingAllowed -bool no

相关内容