Remapping Mac Mail keyboard shortcuts with BTT

I'd like to remap the Mac Mail keyboard shortcuts so that they match the Gmail shortcuts. This is something which was previously do-able with Gmailinator but is no longer supported in Mojave.

So, I defined keyboard shortcuts in BTT which are specific to Mail app (e.g. "E" to archive a message). The problem is that I only want those shortcuts to be active when the frontmost window is the Mac Mail Inbox; not when a compose window is open. If they're active when a compose window is open, then, for example, the "E" key will no longer work.

What's a good solution to this?

unfortunately I don't use mail, but maybe you can use a conditional activation group in BTT to match a specific window title, then add your shortcuts to that conditional activation group.

That's a great solution! (Wow - I didn't even know the conditional activation feature existed)

btw, I noticed that the Window Title (in the BTT activation group rules configuration screen) does not consistently refresh when I switch between different windows in Mac Mail. Sometimes it works, sometimes it doesn't. I'm not sure if that's a bug on in Mac Mail or a bug in BTT?

However, the Focused Element Role does consistently refresh. So that appears to work.

I celebrated too soon.

It breaks Alfred. When the Alfred prompt is triggered (which I do a hundred times a day) BTT doesn't 'see' it as a change of the front most window. This means that any keys allocated to shortcuts (e.g. 'e' in this case) become non-functional when Alfred is triggered when Mail is the front-most app.

Ah unfortunately Alfred is an app that doesn't change any of the "active" attributes. I'm not sure whether it can be detected programatically.

Maybe you could ask in the Alfred forum whether there is a way to detect when Alfred becomes active. Maybe it does send some notifications or similar to which BTT could react. Or maybe there is a way to run an Apple Script when Alfred is opened & closed (that would also allow to disable certain BTT features on demand)

Yes - I could remap the Alfred trigger so that it gets triggered from BTT (instead of a being defined inside Alfred itself).

If BTT know when I'm triggering Alfred, how would I then temporarily disable the Mac Mail shortcut with AppleScript?

The problem is that you would also need a action that runs when Alfred is closed again. Is that possible?

Happily, there's already a thread on the Alfred forums pointing to an Alfred setting which avoids conflict with BTT.

Latest update (BT 2.830) seems to have broken it. Specifically, BT no longer detects when the Focused Element Role changes in Mac Mail unless I manually switch to another app and then switch back to Mail.

For example, if I single-click on an email in the list in my inbox, and then click on an open compose window, then the Focused Element Role will (wrongly) remain as AX Table. But if I manually click switch to another app, and then. back to the compose window, then the Focused Element Role will update.

Similarly (and as was the case in the previous version of BTT) the Windows Title doesn't update, again unless I switch to another app and then come back.

1 Like

Struggling with the same exact issue as @shandy2 in trying to recreate the gmailinator functionality inside of BTT. I've set my conditional group to only work when I'm in the message list for one of my primary inboxes, but BTT sometimes doesn't realize I'm in the right window, or still tries to use the shortcuts even when I'm in a different mail window. Likewise, if I switch away to a different app and then return to Mail the conditional group is activated/de-activated properly relative to whichever window I'm in.

Can we fix this? Should we submit it as a bug? I've installed the Process Priority Helper tool but this doesn't seem to fix it.

In case it helps, here is a screenshot of my conditions. (The stray Window Name criteria are just to restrict the shortcuts to certain inboxes. Same conditional list issue happens without those criteria.)