Sub Hot Key to a Hot Key

Is it possible to have a sub hotkey to a hotkey for conflicting macros? I would like to invoke a global hotkey to find a window on a faceless application and then use key commands I have been using for years in QuicKeys to invoke an action on the found window. This is a workaround because Keyboard Maestro doesn’t work with background applications and is one extra step then I am use to. My thought is if I can just assign them all to the same command and then use the modifier I am use to that would be at least a work around.

I do realize that with the conflict pallet I can name them all the same and that I can use multiple keystrokes to invoke from the conflict pallet. I would rather not do that since I have about 50 commands I have been using that use different modifiers to represent different things and I would rather use those then type in a string of characters after the conflict pallet is invoked if possible.

Example:
Ultra Claw (Command+Option+Control+Shift (⌥⌃⇧)) + P (opens a conflict pallet of 50+ choices)
then
Control (⌃) + a-z to invoke 26 different commands
or
Option (⌥) + a-z to invoke 26 different commands
or
Command () + a-z to invoke 26 different commands
etc.

See How do I use a multiple keystroke trigger?

You can assign multiple macros the same hot key, and Keyboard Maestro will display a palette of the conflicting macros when you press that hot key. You can then use number keys or the mouse, or the first significant letter to select the desired hot key. This is especially useful when you have a variety of similar or related tasks. You can also assign a hot key to a macro group which can activate it for one action (with or without a palette), and the contained macros can have whatever ”second” hot key you desire.

A Macro Group can be activated for one action after you press an initial hot key (optionally displaying a palette of its macros), allowing you to specify any second trigger you like.

A macro can use the Activate Macro Group for One Action action to explicitly activate another macro group for one action, allowing any complex chaining of hot keys.

There is a Typed String trigger, which takes a series of typed characters and then optionally deletes them, but this is restricted to typed keystrokes, so no Control or Command modifiers.

And finally, macros can enable and disable other macros or Macro Groups, allowing all sorts of possible control.

But Keyboard Maestro does not directly support assigning a two-keystroke hot key to a trigger. The problem with multiple keystroke triggers like Option-F R is what to do if you type Option-F A?

Logic dictates that the Option-F A should go through to the system unimpeded, but Option-F R should be swallowed entirely. But this is impossible. The only way to do it would be to swallow the Option-F key, and then swallow the second key and then resubmit the Option F and the second key unless it matches Option-F R.

However, that is fraught with peril and cannot work robustly in the presence of other applications placing things on the keyboard event queue (or even a sufficiently fast typist).

For example, suppose you quickly typed Option-F A B. Keyboard Maestro would have swallowed the Option F and then the A, and then resubmitted it to the event queue, resulting in the stream of characters B, Option-F, A. There is no way to avoid this race condition, and as such Keyboard Maestro does not support any such mechanism.

As described above, Keyboard Maestro has a variety of ways you can use Option-F as a hot key that allows a second key to be used to select a macro. However in all cases it is clear that the Option-F has been used and there is no concept that the Option-F might come back later to do something else.

Thanks Peter for the detailed reply, I do use the conflict pallet dozens of times a day and absolutely love how you can assign duplicate key commands to macros versus the QuicKeys method where things can’t have conflicting keyboard shortcuts and you have to assign them to a pallet if you want do what I am after right now (as a work around in this case). I love being able to assign a conflicting key without worry in Keyboard Maestro.

It sounds like then what would be a possible solution is to use a Macro group that applies to all applications, since in my case Keyboard Maestro can’t detect background applications like QuicKeys can. Then I can check “Show a palette until” and assign a hot key to show the pallet. However I don’t see a way to be able to only run the macros in that macro group unless its macro pallet is showing. Is there a checkbox or drop down I might be missing that would enable this behavior? In other words I would like for keyboard shortcuts in that macro group to not work unless the macro group pallet is showing.

https://wiki.keyboardmaestro.com/manual/Macro_Groups?s[]=macro&s[]=group

If there is a way to do this it seems like that should be possible without a bunch of other complications but you would know better than I of course if this is possible or not.

Here’s another way to do this, without using the conflict palette:

Make a Group (I’ll refer to it as a palette) that contains nothing but aliases to the macros in question. See MACRO: Make Macro Alias for more information.

Have the palette show for one action only, and trigger it with your initial hotkey.

With these aliases, assign whatever hotkeys you want as triggers. So there’s no problem assigning “a”, or whatever, because they will only be active for one action, then the palette goes away, effectively disabling the macros.

It’s a hard concept to get across (although easy to implement), so if I haven’t made myself clear, let me know.

1 Like

Thanks Dan I'll see what I can work out from that, I almost understand but will experiment to understand better. I love the animated gif, very helpful. I just watched your youtube video on customized actions again to make some more since I needed a refresher.

Cool. I often feel like I’m almost getting my point across, but I’m missing something. So please ask question.

I’ll admit I didn’t read the entire thread, so bear with me.

I’m not sure why I recommended using Aliases. Is there some reason you can’t just put these macros themselves (rather than aliases) on a palette that triggers on your first hotkey, and the macros have hotkeys like “a”, etc.?

I mean, the reason you’d use aliases is because you want to have the macros be available even if the palette isn’t showing, or else you want another hotkey for the macros.

Yes because of muscle memory of doing something for years as well as to know if Keyboard Maestro can do this. Currently the fastest way is to press a command and then press two more keys in Keyboard Maestro versus the one keystroke I have used for years in QuicKeys because it recognizes background applications with a window in the front.

I understood that, sorry.

You know what, let me put an example together so we can talk specifics. BRB.

OK, this has 3 macros in this palette.

Ultra Claw Palette Macros.kmmacros (6.1 KB)

When you press the hotkey, it gives you this for one action:

So, in effect, you press your hotkey, followed by "a", or whatever, and your macro launches.

It this good enough?

1 Like

That's it Dan thanks, it is "Shows a palette for one action when:" I thought I had figured it out earlier and posted something but didn't quite get to this one.

Thanks a bunch!

What I am confused about is the difference between

https://wiki.keyboardmaestro.com/Macro_Groups

To have Macros that are active and displayed after you specifically activate them, set the Macro Group to Show/hide a palette. The Macros in the Macro Group will be displayed in a floating Macro Palette and enabled when you press the Macro Group Hot Key and will remain displayed until you press the Macro Group Hot Key again. You could use this to create a set of related actions that do not even need a Hot Key 7).

To have Macros that are always active and displayed in a palette, set the Macro Group to Show a palette. The Macros in the Macro Group will be displayed in a floating Macro Palette and enabled. The palette will close when you press the Macro Group Hot Key and will remain closed (and the macros disabled) until you press the Macro Group Hot Key again 8).

By choosing how you activate the Macro Group, you can create sets of Macros for many different purposes.

If you want to use several macros in succession, configure the Macro Group to be Activated/deactivated or to Show/hide a palette.
If you want to have a global palette of related macros, configure the Macro Group to Show a palette.

From experimenting I don't get the difference, I even just had someone read through this with me and it seems like it is the same with the only difference really being "you could use this to create a set of related actions that do not even need a Hot Key. However I removed a hot key and tried both and they seem to be identical there too. Not sure why the verbiage is the same but said slightly different, it would be more obvious if it was just said exactly the same so you could identify what the difference is more easily.

when you press the Macro Group Hot Key and will remain displayed until you press the Macro Group Hot Key again.

The palette will close when you press the Macro Group Hot Key and will remain closed (and the macros disabled) until you press the Macro Group Hot Key again

Both of them they are disabled when the pallet is not open but just stated in different places in the instructions.

I’m confused too. Perhaps @peternlewis or @JMichaelTX can explain the difference?

If a macro group is configured to show a palette, then the macros are active if and only if the palette is displayed (there has been expressed a strong desire to break this invariant and allow for macro groups that are always active and show a palette some of the time, but that is not how things currently work).

The difference between Show/hide a palette when and Shows a palette until is simply the initial state. The former starts with the palette displayed, the latter starts with the palette hidden (and hence the macro group inactive).

Show a palette for one action starts with it hidden, shows it on command, but only long enough for you to trigger one macro (or perform some other action).

1 Like

That makes sense to have an option to show the pallet when you need a quick reminder but want them active regardless, I could see the use in that.

That seems like a strange distinction but could be handy. I just experimented to make sure I understood you correctly and quit the Keyboard Maestro engine and when I started it I got the reverse results with "Show a palette until" showing when it the engine started and "Shows/hides a palette when:" not showing anything when the engine was started. I experimented with the other two checkboxes "The corresponding status menu entry is selected" and "the corresponding macro palette entry is clicked" and the behavior all seemed the same.

So in short from what I can gather is that and "Shows/hides a palette when:" saves you the annoyance of having to close several palettes when the engine starts if this is clutter on your screen. If that is really the only difference seems like a more descriptive name like "Show Pallet when Keyboard Maestro Engine Starts" with a hover over tool tip that states "macros in this macro group will only be active when the pallet is showing" for both ...[quote="peternlewis, post:13, topic:4583"]
Show a palette for one action starts with it hidden, shows it on command, but only long enough for you to trigger one macro (or perform some other action).
[/quote]

palette when and ...palette until.

So in short from what I can gather is that and "Shows/hides a palette when:" saves you the annoyance of having to close several palettes when the engine starts if this is clutter on your screen. If that is really the only difference seems like a more descriptive name like "Show Pallet when Keyboard Maestro Engine Starts" with a hover over tool tip that states "macros in this macro group will only be active when the pallet is showing" for both ...palette when and ...palette until.o in short from what I can gather is that and "Shows/hides a palette when:" saves you the annoyance of having to close several palettes when the engine starts if this is clutter on your screen. If that is really the only difference seems like a more descriptive name like "Show Pallet when Keyboard Maestro Engine Starts" with a hover over tool tip that states "macros in this macro group will only be active when the pallet is showing" for both ...palette when and ...palette until.

Thanks that is what I noticed to it doesn't have a timeout just waits until you press any key or run one of the macros.

Yes, I misspoke. Obviously "show a palette until" has it shown initially. "show a palette when" does not.

It’s not simply about having to close palettes when you start Keyboard Maestro Engine, it is about your intention.

In one case, you intend the palette to be available pretty much all the time, but might want a way to close it briefly. In the other case, you intend the palette to be used only on occasion. In the former case, you would frequently not even configure a way of toggling it off.

Makes sense.