Detecting Option Key (⌥) Pressed When Macro Triggered from a Palette?

When the following macro is run from the Keyboard Maestro Editor, it properly detects if the Option Key (⌥) is pressed.

Option Pressed.kmmacros (3.5 KB)


However when the macro is run from a palette rendered using the Show Palette of Macros action the behavior is different.

Keyboard Maestro Export

If the option key is pressed when the macro is clicked on the palette, the macro does not run. Instead the macro is selected in the KM Editor.


@peternlewis, I assuming this behavior is intentional. Is it documented somewhere in the wiki that I'm missing? I checked two places and didn't find anything:

It might be documented in other places, but it is documented here.

Before @peternlewis answers officially, I can confirm as a user that this is intentional and very useful behavior. It works with any palettes including the Conflict Palette.

I use this method constantly as the quickest way to start editing my Macros. I use both Application and Conflict Palettes a lot so, very often I will be looking at a palette that has a Macro I want to use and before using it by clicking on the palette, I decide I want to tweak it. Holding down Option ⌥ while clicking the palette entry, takes me straight to the Macro in the Keyboard Maestro Editor.

I do also use modifier keys to give different behaviors to a macro when clicked in a palette (I just avoid using ⌥). I find Shift or Command work fine. So, submitting Shift or Command for Option in your above Macro will get the behavior you want.

2 Likes

I also use Alt+Click on palettes often.
Is the correct way to set up a Cmd or Shift click action to have an if condition that checks for modifiers?

Yes, you can do exactly as in @_jims's example Macro in the first post but just use any other modifier apart from Option.

Thanks, @Zabobon. Maybe @peternlewis will copy that note and use it on other palette wiki pages.

1 Like

This is a bit of an extreme case, but all of these work just fine:

1 Like

Yes, it's a good idea putting the key to what holding down modifier keys will do in the Macro name. I have now got into a system where I use symbols in the name to keep the name as short as possible.

My Macro to create folders for trips puts these symbols at the front of the Macro name (pencil to open an apple note by clicking while holding down Command key, airplane to open my flight booking by clicking while holding down Shift Key☺︎)

By putting the symbols at the start of the name, it also means they all get listed together in the Conflict Palette.

image

2 Likes

Hi, @Zabobon. Thanks for sharing your approach. Looks like you are using SF Symbols. I use unicode characters, but I had never considered SF Symbols; now I will. :smiling_face:

BTW, I particularly like to keep my macro group names short so that I can set the group column relatively narrow in the KM Editor, but still quickly scan and differentiate the groups. However, if I'm developing a new macro and need quick access to a couple groups, I'll sometimes temporarily add a emoji prefix (e.g., :red_circle:) so that I can quickly spot and switch groups. When I'm finished I'll then remove the prefix.

With palettes, my personal preference is to add unique single-character prefixes and, within logical groups, list those items alphabetically. For example, this is my main palette triggered with Hyper+A:


My goal is to trigger items using a single keystroke, but in some cases, like in my post above, use two characters: UJ, UC, UT.

(I've also developed a technique to trigger the eight variants of Engine.log Tool depicted above using only the keyboard. I'll share that in a separate post.)

On the topic of ordering, I'd like to remind folks of @DanThomas's excellent Palette Organizer.

1 Like

9 posts were split to a new topic: SF Symbols

This is interesting but maybe moving a bit off-topic so, I have moved to a new thread :grinning:

Are you using a show palette of macros action and then selecting them by typing the prefixes, or activating a macro group palette with genuine hotkey triggers?

Both approaches seem to have their own advantages…