How to Tell KM to Enact Macro in Only When in Message List View

Hey there, here's what I'm trying to make happen>

Arrow Key Right: Archive Message
Arrow Key Left: Toggle Flag message.

But ONLY when i'm in the list view of messages. Otherwise I can't use my left or right arrow key when composing.

Is this possible? I've googled but I can't find what that part of the app is called; is it its listview?

Thanks in advance.

The simplest way to do this is to assign a keyboard shortcut in System Preferences to the corresponding menu items in the

I’m still in High Sierra (although my computer is broken this is from memory), where toggling a flag would be achieved using the menu item called "Red" (equivalent to hitting the toolbar button to flag/unflag the selected message). You can assign the left arrow key as its shortcut, which preserves its regular use during typing.

The same process can be done for the menu item associated with archiving a message (probably called "Archive" or "Archive Message", but you’ll need to check for yourself).

Thanks. I tried Flag Red and Flag Message Red but to no avail. I’ll try red. Incidentally how do you know what the wording is?

It’s the name of the menu item exactly as written (minus any pictograms in front of the name).

Not unless the singular menu item you would typically click on last is actually called that in your version of macOS. In High Sierra, it’s just "Red" (with a small flag symbol before it, which is to be ignored).


Don’t go guessing menu names, you’ll waste your time. You need to look at the menu item within the application, and copy it verbatim, including letter case, i.e. "Mark As Unread" would not be the same as "Mark as Unread" (if such a menu item exists with either name).

If a menu is nested, ignore the names of the parent menu item, and only use the name of the final menu item one would click to perform the action.

if you pick the “select or show menu item” you can access the menu list for the apps by clicking the “menu” selector, and drill down from there to the right menu entry.

This way you don’t have to type it correctly, you can just select “red” from the list.

Is this a new feature of Mojave's System Preferences or are you referring to a Keyboard Maestro action?

It's a KM action. I use it frequently myself when using KM to customize keyboard shortcuts for menu commands, rather than having KM type the default shortcut or trying to work with the System Preferences panel.


1 Like

Yes, this is my preference too for most situations, but in this particular case, I believe my recommendation to the OP is the easiest and most effective way to do what he wants.

However, thank you for supplying that image, which I can use to tell @James_Veitch that the names of the two menu items he needs to input into System Preferences are "Red" and "Archive" (capital first letters, lowercase for the remaining, and no extra spaces before or after the text). James, please report back how it goes.

1 Like

Hey James,

Is it possible? Yes. (And it's complicated.)

Is it a good idea? No.

You cannot hijack normal keys under special circumstances and then expect them to work efficiently during normal use. The macOS does not provide an efficient detection mechanism for this kind of context switching.

Use and (or similar modifier combination).

That's an easy reach for your right hand.