-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automate setting a default keyboard shortcut in OSX #1
Comments
Opened a question on stack exchange and threw up a bounty. |
Found some great resources and made general progress. First of all, the property list that contains this shortcut is $ defaults read pbs
{
NSServicesStatus = {
"(null) - VimAnywhere - runWorkflowAsService" = {
"key_equivalent" = "@^v";
};
"org.vim.MacVim - MacVim/New MacVim Buffer Here - newFileHere" = {
"enabled_context_menu" = 0;
"enabled_services_menu" = 0;
};
};
} Now, being as this is a nested property list, it isn't really easy to edit it via the command line. Even if you read the entire property as it is now, process it and modify it, writing it back becomes another problem. Apparently, you can also do this in pure applescript (which terrifies me, but I'm going to give it a shot). scpt way: https://discussions.apple.com/thread/4709713?tstart=0 |
Something like: set theServiceName to "(null) - Print to PDF - runWorkflowAsService"
set libPrefPath to POSIX path of (path to preferences folder from user domain as text)
set PlistFile to "pbs.plist"
set PlistPath to libPrefPath & PlistFile as text
set mainPropertyItem to "NSServicesStatus"
set theKey to "key_equivalent"
tell application "System Events"
set gp to (get property list item theServiceName of property list item mainPropertyItem of property list file PlistPath)
tell gp
--set value of property list item "enabled_services_menu" to true
--set value of property list item "enabled_context_menu" to true
set value of property list item theKey to "@^h"
end tell
end tell
do shell script " defaults read " & quoted form of PlistPath though I can't exactly get this to work. |
Would be over the moon if anyone could figure this one out. I never could quite get it to work on OSX. |
Enabling the shortcut via System Preferences results in this entry appearing in the Mac OS X user defaults system :
You can add this manually by running the following:
Is this an acceptable solution? I am not entirely familiar with MacOSX so this answer might be incomplete, or incorrect. |
Following up in #74. |
Closed by #74 |
Upon running the install script, a default keyboard shortcut should be set for invoking vim-anywhere on OSX.
I have absolutely no idea how to do this.
The text was updated successfully, but these errors were encountered: