Quit but not quit

I'm trying to use Keyboard Maestro to workaround a bug in El Capitan.

When I'm working in Apple Remote Desktop, I want the cmd-Q keystroke to only work "remotely". I do this by reassigning ctrl-cmd-Q to Quit remote desktop. That way, if I hit cmd-Q, it only "sends" it to the remote computer I'm working on, and doesn't actually quit the Remote Desktop program. This used to work beautifully up until the recent El Capitan upgrade.

So I thought I could use Keyboard Maestro to work around this. Basically, the idea is that when I'm in Remote Desktop and not logged in to any remote computers, the name of the frontmost window is Remote Desktop, and when I am logged in to another computer, the name of the frontmost window is the name of that computer (e.g. "Other Computer").

So I created a macro that basically says if I hit cmd-Q, and the name of the frontmost window is not Remote Desktop, go ahead and execute a cmd-Q (i.e. send it to the remote computer). And if the name of the frontmost window is Remote Desktop, do nothing. But the result seems to be that the keystroke cmd-Q does nothing ever. Am I doing something wrong?

Here's the exact macro:

To me, it looks like the “IF” action is disabled. Perhaps it’s just your color scheme, but make sure it’s not disabled.

Oops, thanks for the catch, Dan. It was disabled when I was trying to fix it, but even enabling it, it still doesn’t work.

I did just notice something though…if I’m logged in to a remote window (i.e. frontmost window is not “Remote Desktop”), and I hit cmd-Q…nothing quits on the remote machine. BUT, if I immediately switch to another app on my computer (e.g. Excel, Safari, etc.), then the cmd-Q kicks in. There’s some sort of weird delay and the cmd-Q works on other apps, even though this macro is specifically set up to run only when Remote Desktop is at front.

Hmm…it just occurred to me that maybe the reason this isn’t working is that it’s creating an infinite loop? Is the simulated keystroke cmd-Q being treated like an “actual” keystroke and therefore looping back to the original trigger?

If so, is there a way to “break” the loop so that the “Type the cmd-Q Keystroke” is not intercepted by Keyboard Maestro?

1 Like

I guess I should have looked more closely at your macro. The idea of passing a keystroke along like you’re trying to do has been discussed before, and the consensus is that it’s rarely a good idea.

However, if you want to see if it might work, try the following:

Before the “Type a keystroke” action, use a “Set Macro or Group Enable” action to disable this macro. That will prevent a loop, and you can see if it manages to pass the keystroke onto the app or not. It’s obviously not a permanent solution - but try it and see.

If it works, then we can talk about how to create a solution.

I would expect the ⌘Q keystroke to be intercepted without any problem.

Silly question: Your Macros for Remote Desktop group, is it set only to be available only for the Remote Desktop application?

Next question: What happens if you make the ⌘Q keystroke do something non-damaging, such as invoking a zoom or something?

If you have a Type Keystroke action that types the keystroke that is a hot key trigger, the results are indeterminate and will vary depending on many factors. Whether the key gets through or triggers the macro is unknowable.

In this case, instead, make a macro group and make it active only when the front window title is “Remote Desktop”, and have your macro simply hot key Command-Q, action, do nothing.

Argh, there’s definitely something wrong with my system’s App Shortcuts and Keyboard Maestro’s not going to be able to work around it.

Thanks for everyone’s help!