繁体   English   中英

通过终端或Applescript OSX 10.1启用Yosemite的Dark模式

[英]Enabling Yosemite's Dark mode through Terminal or Applescript OSX 10.1

有没有办法通过Shell脚本(终端)或Applescript打开Yosemite的黑暗模式? 我努力了:

sudo defaults write /Library/Preferences/.GlobalPreferences AppleInterfaceTheme Dark

但它不起作用。

请帮忙!

我为这个目的制作了一个命令行应用程序: dark-mode

我想到了。

我在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

我不完全确定,但你可能需要重新启动一些服务来刷新它:

sudo killall Dock; killall SystemUIServer; killall Finder; killall cfprefsd

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM