Capture One shortcuts for the terminally curious: part 1
This is a part 2 to my last post like a year ago (sue me I’m busy) where I was looking at short-cutting stuff not supported by C1 – quick access to functions that are missing from C1’s shortcuts capability (like work spaces, scripts, styles).
While the workaround using the OS was fine, the process is a bit shite if you have to set up a lot of shortcuts. As it’s now a year later and nothing had changed from C1 side, I thought I’d look at it again to try to find a better way to set these up. What follows is a bit of a hack through C1 plists to automate the process, but it works and its pretty cool.
I don’t know how useful it is or who even who the hell reads these posts, but if nothing else then it served a sort of expressive anger management because its baffling to me that this basic functionality is not in the application. Leave a comment if this was helpful.
Down the rabbit hole
After an evening of reading/google I found a helpful article in an ancient book (Modding Mac OS) which lead me to a couple of (old) blogs on the topic of “NSUserKeyEquivalents”. You can see those here and here.
For the curious, “NSUserKeyEquivalents” is a dictionary container that all Mac OS apps can use (within the app’s own main plist) that stores the shortcuts you make via the system prefs. These articles were not entirely conclusive but they provided most of the working parts and bread crumbs needed for a working solution, and from the comments some insights into other approaches.
Anyway, the tl;dr of all this research was, it turns out you can use shell commands to set up the shortcuts.
Using the methods described in the first post to set up a sample, I did a simple test via the system prefs with CMD+T for default workspace, then opened the C1 plist in textMate to see how the data was stored.
A new entry NSUserKeyEquivalents is made and now contains the value pairs for the menu item (Window->Workspace->Default) and it’s shortcut (CMD+T).
Note: Modifier keys are represented as: @ for Command, $ for Shift, ~ for Alt and ^ for Ctrl – so the string “@$~^t” represents CMD+SHFT+ALT+CTRL+T
I’d read about issues with Function keys so I made a shortcut using (F10) which resulted in:
The F keys and other functional keys are harder to do using shell. You cant just type “F10” unfortunately. These keystrokes have to be represented by their Unicode values and Unicodes need to be Unicode escaped to work in a shell command. Unicode escaping consists of combining \U followed by the 4 digit unicode for the corresponding value. e.g. F10 is listed as the hex 0xF70D. This, when escaped, is “\UF70D”
You can find the list of Mac Function Key Unicode characters here
Creating a shell command
The shell command was a bit of trial and error but uses the following logic:
- Use the defaults write option to modify the plist
- I found it best to use approach of the list type syntax in the shell command so you can send the config once. Note, because my method does not use the -dict-add command to add to any existing arrays, every time you run this command, it will overwrite any existing shortcuts.
- The application bundle identifier is com.phaseone.captureonexx, where xx is the version being worked on. I use 12, so e.g. com.phaseone.captureone12
- The item to be edited is NSUserKeyEquivalents
- The arrow notation in the manual process to denote the menu hierarchy is (the one exposed via the testing) represented with “\033” for the arrow, then the name of the menu/s.
- The menu and the shortcut for it, are separated with “=”
The result example (for) F10 is:
1 |
defaults write com.phaseone.captureone12 NSUserKeyEquivalents '{"\033Window\033Workspace\033Default"="\UF70D";}' |
The list approach allows you to add a second combo after the “;” – so a single command with a list of menus and corresponding shortcuts looks like:
1 |
defaults write com.phaseone.captureone12 NSUserKeyEquivalents '{"\033Window\033Workspace\033Default"="\UF70D";"\033Window\033Workspace\033Simplified"="\UF70E";}' |
This example sets F10 to the default workspace, and F11 to simplified workspace and thus allows you to modify lists/batches of shortcuts – great for styles in-particular.
Next…
Around the time of that last post I had also started experimenting with Applescript because I thought the Capture One library might offer a solution to the initial problem (it didn’t). But! Applescript can execute shell commands as part of a routine – and variables from it can be injected into the shell command so now I’m thinking I have everything I need to make a fancy set-up app… This shell command won’t work in Applescript just yet without a bit of tinkering and character escaping. I will (maybe next year?!) do the next post on creating the set up script… but hit me up if you have a use case for this and see what I can make.
Pingback: Capture One shortcuts for the terminally curious: part 2 – SHOOT MACHINE
Pingback: Making a script applet – SHOOT MACHINE