以编程方式将键盘快捷键添加到 Mac 系统偏好设置 [英] Programmatically add keyboard shortcut to Mac System Preferences
本文介绍了以编程方式将键盘快捷键添加到 Mac 系统偏好设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我转到系统偏好设置、键盘、键盘快捷键,然后是应用程序快捷键,我可以定义要在 Mac 上使用的自定义快捷键.
If I go to System Preferences, Keyboard, Keyboard Shortcuts, then Application Shortcuts, I can define custom shortcuts to be used on a Mac.
可以通过 Applescript 访问此功能吗?
Any way to access this functionality via Applescript?
推荐答案
快捷方式存储在 ~/Library/Preferences/.GlobalPreferences.plist 中的 NSUserKeyEquivalents 字典和应用程序的属性列表中.
The shortcuts are stored in NSUserKeyEquivalents dictionaries in ~/Library/Preferences/.GlobalPreferences.plist and the property lists of applications.
defaults write -g NSUserKeyEquivalents -dict-add Duplicate '~@d' Minimize '\0'
defaults write com.apple.finder NSUserKeyEquivalents '{"Show Package Contents"="@\r";}'
快捷方式格式在Cocoa Text System 文章.
The shortcut format is described in the Cocoa Text System article.
这篇关于以编程方式将键盘快捷键添加到 Mac 系统偏好设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文