简体   繁体   English

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

[英]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.

相关问题 在 Swift 中禁用 mac OSX 应用程序的黑暗模式 - Disable dark mode for mac OSX App in Swift 有没有办法根据系统暗/亮模式更改 macOS 终端的主题/配置文件? - Is there a way to change macOS Terminal's theme/profile based on the system dark/light mode? 如何在 Catalina 的 Auto Appearance Mode 中检测 OSX 是处于暗模式还是亮模式 - How to detect if OSX in dark or light mode in Auto Appearance Mode in Catalina OSX更新到Yosemite后,“告诉”Spotify播放的Applescript无效 - Applescript to “tell” Spotify to play isn't working after OSX update to Yosemite Applescript或Shell脚本关闭OSX中的每个未使用的终端窗口 - Applescript or Shell Script to close every not-in-use terminal window in OSX 如何使用AppleScript向终端发出命令以释放RAM空间OSX ML - How To Make a command with AppleScript to Terminal to free ram space OSX ML 通过终端或 AppleScript 以编程方式更改 OSX 键盘布局(“输入源”)? - Change OSX keyboard layout("input source") programmatically via terminal or AppleScript? 如何在OSX上获取WebView(或WKWebView)以在Mojave中采用暗模式 - How to get WebView (or WKWebView) on OSX to adopt Dark Mode in Mojave 为什么在OSX Yosemite中未设置我启动的工作的EnvironmentVariables - Why are my launchd job's EnvironmentVariables not being set in OSX Yosemite OSX中的Flash 10.1多点触控 - Flash 10.1 Multitouch in OSX
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM