While using Sketch day to day, I found myself looking for a faster way to align objects and have access functionality that I only use sparingly. Going back and forth to the Align menu manually or resizing artboard height, minimising image size, flattening compound shapes and pixel-fixing objects can become extremely slow and tedious.
To increase my productivity, I ended up converting a spare MIDI pad device into a shortcut machine that’s sped up my workflow and given me access to my less frequently used shortcuts more easily.
The MIDI device
You can use any MIDI device to achieve what I’ve done. The one that I had spare was the Korg nanoPAD2. Some others that I’ve found work well for shortcuts are the Ableton Launchpad Mini and its big brothers. If you have a spare MIDI keyboard lying around, that’s also perfectly fine.
Set up the device
While you may need to install the driver software that comes with your device, it isn’t usually necessary.
All MIDI devices use the same principle in their operation: a button press sends a simple set of values indicating things like note and velocity — in MIDI format — to your computer. Before you can start using your device as a shortcut powerhouse, however, you’ll need to find out what values your device is sending — the default values vary from model to model.
Some devices have manuals (like the Ableton Launchpad) that specify what value each button sends when in each mode. Others (like the nanoPAD2) let you assign custom values. The simplest way to find out what your device is sending through to your Mac is to monitor its signals. Unfortunately, there’s no native functionality for this in OS X. The app that I use is called MIDI Loupe and is available for free from the App Store.
Upon starting up MIDI Loupe, your device should appear on a list at the left of the app, with a tick indicating that the device is active. If you press some buttons on your MIDI device you should see the names for each signal appear in the log. We’ll go into what information you need from here shortly.
Add new shortcuts
At this point, you can add the new shortcuts for Sketch that you want to simplify with your MIDI device. You assign shortcuts in System Preferences under:
System Preferences > Keyboards > Shortcuts > App Shortcuts > Sketch.app
Click “+” while the Sketch.app menu item is selected to bring up the dialogue.
The ‘Menu Titles’ here are the same as the menu names in Sketch. If you want to assign a shortcut for aligning an object to the left, for example, enter “Left in Artboard” into System Preferences. You should use this over just the“Left” title because it covers all scenarios. “Left” won’t work if an object is selected by itself.
Enter the menu title of the menu item that you’d like to use and then create a shortcut sequence. I prefer to assign rather complex shortcut sequences to avoid conflicts with existing shortcuts. This will also let you save the simpler shortcuts for your actual keyboard.
Connect the dots
Now that you have a shortcut set up for your MIDI device and the device itself sending signals, you’ll need to connect the two together by converting the MIDI signals to keystrokes.
To do this, I use another free program called midiStroke. This will let you convert your MIDI signals to the keystrokes that you’ve assigned as Sketch shortcuts in System Preferences.
With midiStroke open, check that your MIDI device is selected from the “src” dropdown menu.
Remember those MIDI signals that we were using MIDI Loupe to identify before? This is where we’re going to use them. With MIDI Loupe open, press the button on your device to which you want to assign a shortcut and take note of what signal is being sent.
In this case, the top left pad of my device sends Note 53 on Channel 1. When looking at the log, you can disregard all other information. You’ll either see this ‘note number’ after the text Note On/Off, Control Message or Program change — with the most common being Note On/Off. Just add this to midiStroke to convert it.
In the “num” column, enter the main MIDI note that your device sends when you press the desired button. The default Channel is usually 1 or Global, but they can differ; just make sure that they match up.
Important note: midiStroke saves your keystrokes assignments when the program closes. If it crashes in the middle of a session, you’ll lose your progress. Make sure that you close and re-open every so often to save your assignments!
Test that your MIDI shortcut works in Sketch.
Go forth and assign as many MIDI shortcuts as you like! A few that I use often — other than the alignment tools — are “Resize to Fit Height” (with the Automate plugin), “Flatten” (for compound shapes), “Minimize File Size” and “Fix Selected Pixel Imperfect Layers” (with Pixel Perfecter).