[英]Enabling Yosemite's Dark mode through Terminal or Applescript OSX 10.1
Is there any way to turn on Yosemite's Dark Mode through Shell Script (Terminal) or Applescript? 有没有办法通过Shell脚本(终端)或Applescript打开Yosemite的黑暗模式? I have tried:
我努力了:
sudo defaults write /Library/Preferences/.GlobalPreferences AppleInterfaceTheme Dark
but it does not work. 但它不起作用。
Please help! 请帮忙!
我为这个目的制作了一个命令行应用程序: dark-mode
。
I figured it out. 我想到了。
I did it in Applescript like this: 我在Applescript中这样做了:
do shell script ("sudo defaults write /Library/Preferences/.GlobalPreferences.plist _HIEnableThemeSwitchHotKey -bool true") with administrator privileges
tell application "Finder" to activate
delay 0.2
tell application "System Events"
key code "17" using {option down, control down, command down} #Option+Control+Command+T
end tell
I'm not entirely certain, but you might need to restart some services to refresh it too: 我不完全确定,但你可能需要重新启动一些服务来刷新它:
sudo killall Dock;killall SystemUIServer;killall Finder;killall cfprefsd sudo killall Dock; killall SystemUIServer; killall Finder; killall cfprefsd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.