To give a basic example, let's say you want to use ⌘C as a hot key trigger, but you don't want it to override the system's copy keyboard shortcut; instead, pressing ⌘C would both (i) trigger the KM macro in question and (ii) invoke system copy functionality. Is there any way to accomplish this?
For your basic example, in the macro (i) just include a KM
Copy action to perform the standard system copy-to-clipboard function. That way both things you want (i) and (ii) happen.
For things you want to happen that don't have a ready-made KM action (like the
Copy above) you could just use the KM
Select or Show a Menu Item action instead.
Sorry, @tiffle. My example probably wasn't the greatest. How about something that doesn't have a KM action or a menu item? For example, you use ⌘⇥ to browse between open windows. Let's say you additionally want to use ⌘⇥ as a hot key trigger. What would be the solution here?
Do you want that hot key to have multiple uses in the same application? If not, then place the macro that's triggered by the hot key in an application-specific macro group.
If you want multiple uses in the same app, then you'll have to put some kind of conditional logic in the macro to determine which particular use you want. For example, if the
Edit>Copy menu is enabled - indicating you've selected something - then do the standard copy action, otherwise do something else. (Sorry if that's also a bad example!!)
Maybe someone else can offer some other option?
Yeah, they're not application-specific, and I don't think this is a situation where conditional logic would solve it either. Thanks, though!
So, you want ⌘⇥ to trigger a Macro and do whatever ⌘⇥ does by default? In which case, in the Macro you trigger with ⌘⇥ add in a Keyboard Maestro
Type a Keystroke Action and have that Action simulate ⌘⇥
It might help to know how that would be done with BTT. Maybe it can be translated for KM.
Example: ⌘+c is always copy or what the app specifies. This doesn't need any setup.
But BTT can execute ⌘+c also as a key sequence (a kind of string tigger). This triggers the second action at the same time.
So the shortcut and the string are executed.
Maybe like this?
The KM manual warns us: "Do Not Use for the Keystroke of an Active Hot Key Trigger".
Yes, but in this case the OP wants to trigger a Macro and have whatever hotkey they pressed, pressed again to do the original macOS function. So, the simulated keypress is not triggering the Macro (as in the warning above) but the other way around...
I think we still lack a real-world example, without which we can only suggest workarounds which may or may not fit individual cases. I dimly recall that I did once have the same sort of question myself, but found another way to do things in KM – and that would have been quite specifice to the particular problem.
I did get that, but is there not a danger of the macro triggering itself?
I'm not going to search (feel free!), but I seem to recall that KM users have mentioned in the forum that they have had no problems having macros simulate keypresses that are used by (other?) macros, but since the outcome may "vary depending on unpredictable factors", I would be wary without good reason, which I don't think we have any sight of yet.
Yes, you are absolutely right. And in fact that is exactly what the warning is about. There probably are workarounds but none as simple as just picking a different unused hotkey to trigger the Macro...
Thanks, guys. What I'm actually trying to accomplish is a little difficult to explain, so I've been trying to give simpler examples, but let me try.
I recently started using a utility app called AltTab, which basically makes Mac OS's app and window switching functionality work a lot more like that of Windows. I've been using Mac OS for over a decade, and have literally been looking for an app like this all this time, so I was pretty excited to stumble on this.
The one shortcoming of AltTab, for me personally, is that when you switch to one of an app's windows, it only brings up that specific window, as opposed to bringing all the app's windows to the front (in addition to putting the window you selected into focus), which I'd prefer.
I was thinking KM could help address this shortcoming. Specifically, I wanted to create a macro where ⌘⇥ wouldn't only trigger AltTab's app/window switching functionality, but would also trigger a KM macro that, upon the release of the ⌘ key, would bring all windows to the front.
However, as we've been discussing, that would require ⌘⇥ to trigger both AltTab and this KM macro.
I hope this further detail is helpful! I'd be grateful for any ideas.
AltTab has a ton of options (and they’re not well laid out in my personal opinion). Have you looked extensively through the settings screen for it?
Yes. I even chatted with the developer . He described this as a "niche case," which I find surprising. But, in either case, it doesn't sounds like he plans to add this functionality any time soon.
Is it unthinkable for you to do that in two steps?
- alt-tab selects the window of your choice.
- KM brings all windows of this app to front.
That's because it's meant to be a windows switcher, not an app switcher. I tried the app (again) just a week or so ago and realised it is very much focussed on windows switching only.
Have you tried the app Witch? That will do what you want.
If you want to stick with AltTab, I think @Frankb has provided the answer.
The macro below is complete nonsense I can't do better, but at least everything works with ⌘+tab. Users who understand something about KM can certainly easily do much better.
In the settings of AltTab, the window switching is triggered with ⌘+9 (not: ⌘+tab)
KM waits until the desired window of an app is selected with AltTab (I just listed a few apps as "conditions").
KM brings all windows of this app to the front.
I like your thinking here!
Unfortunately, I don't think this quite works, since when you're navigating through a bunch of possible apps/windows before you find the one you want, you're pressing ⌘⇥ over and over again, thus triggering the macro multiple times even though you only mean to trigger it once. (Ideally, there would be a way to say "don't allow this macro to be triggered again until the ⌘ key has been released.)
Also, AltTab doesn't focus the window until the keyboard shortcut, or I guess ⌘, has been released, and I'm not sure how to mimic this in KM.
Mmm, have you tested it? It works for me.
You can press ⌘tab as many times as you want or until you find the right window. KM waits until AltTab is gone and the target app is in front. Only then it brings all other windows of this app also to the front.
But the structure of the macro is nonsense. Someone can do it better.
I did, so it's odd that we're getting different results.
Intuitively, though, when you're holding down ⌘ and pressing ⇥ multiple times, as you do when you're stepping to the window you're looking to select, you'd be re-triggering the macro every time you press ⇥. Unless I'm missing something.