I recently enjoyed using Gmail shortcuts in MailMate, and wanted to bring those same shortcuts to the default Mail app on macOS.1 GMailinator, the only Mail plugin I could find to do so, hasn’t been updated in four years, so I didn’t bother installing it. Instead, I started looking for another way, and I think I’ve found it.
The Short Answer
If you don’t want to read to the end, the end result was that I created the shortcuts in Keyboard Maestro, but doing so involved more than just setting up a simple key remapping. Here is a screenshot of my Keyboard Maestro macro to use the ’E’ key to archive messages in list view:
Here is a link to download the Archive macro:
IMPORTANT: You will also need to map the first keystroke in the macro to the ‘Archive’ menu selection in System Preferences. This is explained in more detail in the “Long Answer” section below, complete with screenshot. In my case, I mapped the ‘⌘Return’ keystroke to Mail’s ‘Archive’ menu selection.
I’ve only set up one shortcut so far, plus the “Move” shortcut (which I tied into Mail Act-On’s ability to call up a window to file documents). Hopefully that is enough to get you started mapping other keys. If not, the long explanation of the macro is below.
The Long Answer
Before turning to Keyboard Maestro, I first tried setting up an App Shortcut in System Preferences (System Preferences > Keyboard > Shortcuts > App Shortcuts). I discovered, though, that App Shortcuts must use a modifier key, such as the Command or Control key. Many Gmail shortcuts only use a simple letter key, such as ‘E’ to archive, so App Shortcuts wouldn’t work.
I next tried to set up a simple Keyboard Maestro macro that called the “Archive” command any time I typed the ‘E’ key in Apple Mail. Unfortunately, that macro made the ‘E’ key nonfunctional when typing text in a mail message. Back to the drawing board.
I needed to find a way for Keyboard Maestro to be able to determine when Mail was only in list view (i.e., just displaying a list of messages, and nothing else), versus when I actually needed to type text (and needed that darn ‘E’ key to work). I examined Mail, and found that “Archive” in the toolbar menu (Message > Archive) became inactive when creating, replying to, or forwarding a message.
Voila. I had found a way (the Archive menu item) for Keyboard Maestro to monitor the state of the Mail app. If ‘Archive’ is active in the menu, then I could set things so typing ‘E’ triggers the Gmail archive shortcut. If ‘Archive’ is inactive, then I could set things so typing “E’ simply types “E.”2
For this to work, you first need to set up a keyboard shortcut for ‘Archive’ in System Preferences, so that you have a shortcut to map ‘E’ to. For reference, here is a screenshot of where I’ve mapped ⌘Return to ‘Archive’ in my App Shortcuts in System preferences (System Preferences > Keyboard > Shortcuts > App Shortcuts):
Unfortunately, I ran into one final problem. I found that typing the ‘E’ key in a mail message was too laggy, with the ‘E’ occasionally appearing on screen a few seconds after I typed it. The way around this was to completely disable the macro if the “Archive” menu item wasn’t active. The ‘E’ key would then be typed, and the macro reenabled. These are the last three steps contained in the macro.
This seems to work in my limited testing. I’ll report back if I run into more problems.
- MailMate is great, but seems to have issues with my work Office 365 account. I’ll probably continue to use it for my other accounts, and hope I can find a solution to the glitches. ↩
- Don’t let the presence of ‘Archive’ in the first action of the macro throw you off when creating new shortcuts. The test for the state of the ‘Archive’ menu item should be in your macro, even if you’re creating a shortcut to forward a message, for example. ↩