Tap twice deactivates tap once

I want to have Cmd+W (tapped twice) to open Whatsapp. But, that deactivates Cmd+W (tap once). E.g., Cmd+W (tap once) to close tab in Safari doesn't work as a result.

Any solution?

Any Hot Key trigger will capture the keystroke.

Also, think about it - how could Keyboard Maestro know when you tapped the first time whether you were going to tap the second time or not. It is impossible. So you could have another macro with the ⌘W tapped once trigger, but you would have no way of knowing what to do at that point. Should you close the Safari tab, or not, how could you know, you'd have to wait and see whether the “tapped twice” macro fires and then decide. Which you could do, but it would necessitate a lag in the behaviour of ⌘W which would be undesirable.

Hi and welcome to the forum!

Take a look at the Hotkey/USB Key macro here:

Perhaps at some point @peternlewis might consider adding something like this to the trigger section. It's simple and works reliably.

The issue is that it introduces an undesirable lag in the response time of the trigger.

Sometimes that is acceptable, but often it is undesirable.

For example, consider the case of one tap closes a window, and two taps close all windows. There is no necessity for the lag because the second tab is a superset of the first behaviour. So this way your response for closing a window has no unnecessary delay.

If you really want two independent actions, then the delay is necessary, and the solution is relatively straight forward, using a variable that is cleared in the one tap macro, and then a pause in the one tap macro, and then a test to see if the variable is changed, and the two tap macro simply sets the variable and carries on.

I would argue that the 0.2s delay used in the macros I posted isn't likely to feel very laggy in real terms. The only time it's ever been an issue is when someone asked if they could use a single character that might also be used for typing. The example was:

  • Tap "j" types "j".
  • Double-tap "j" does something else.

The short lag interfered with fast typing, of course, but this isn't a recommended approach anyway.

It would be cool to have a built-in option for independent actions depending on tap type, within one macro, and it's something I see questions about very often.


In other apps this also works with a string. cmd+j or j+j. The string can be configured so that the shortcut is only executed when cmd is released. So the string is unique.

If cmd+j is already occupied by the app, then it needs an action to block it.
cmd+j = does nothing

Then cmd+j must be set up again as a string for the action that was blocked. That's just a comment.

@noisneil Multipress macros are excellent. If a user doesn't want that, he can use the light version built into KM, short/long press. This also works well.

1 Like