Keyboard Maestro hotkeys are slightly laggy vs. System Preferences Keyboard Shortcuts

I'm attempting to begin using Keyboard Maestro to set and sync all of my custom keyboard shortcuts.

I have traditionally used macOS System Preferences > Keyboard > Shortcuts to set these Keyboard shortcuts.

Using Keyboard Maestro, I'm noticing a slight lag/delay when pressing hot keys, vs. the immediate input when using the system dialog.

Even when I use "is down" as the hot key trigger, Keyboard Maestro is still noticeably slower to react than System Preferences. "Is pressed" is even worse.

This is very noticeable when using the tab-switching shortcuts above. It's very fast to tab-right using System Preferences. It feels comparatively laggy to tab-left via Keyboard Maestro.

Is there any way I can modify Keyboard Maestro to have the same performance as System Preferences? Or is this an intrinsic advantage of System Preferences keyboard shortcuts?

I use KM for these type hotkeys/shortcuts all the time, and I find them very fast. I have a iMac 27-Inch Late 2015, MK482LL/A,Quad Core 3.3 i5, Retina 5K, 2TB Fusion Drive, running Keyboard Maestro 8.2.4 on macOS 10.12.6.

The key HW would be processor and RAM. What do you have? What macOS are you running?

I doubt KM could ever be as fast as the SP shortcuts, but with a fast Mac there is little or no noticeable difference.

Here is a complex Macro that I built, designed to work with many different apps. But when Chrome is frontmost, it goes to the next tab.

Demo of Chrome Tab Switching Using KM Macro

Demo-Chrome-Tab-Switch-Macro-KM8-AN

Macro

I'm using a 2018 15" Macbook Pro with 16GB RAM. I do not think the hardware specs are introducing any lag.

The Keyboard Maestro behavior seems relatively fast and fine... it's just not as fast as System Preferences.

I've been using those tab-switching keyboard shortcuts for years and am used to an immediate response response. Any delay seems extremely laggy by comparison

System Preferences seem to input the action immediately when the key actuates into the "down" position. Keyboard Maestro has a small delay. Because I'm so used to the fast response, it feels almost as if KM is waiting for a Key Up before activating the command. (I'm using "is down" as the trigger).

I'm mainly wondering if this delay is some special setting I can tweak in KM, or if it's a bottleneck introduced by the OS / where KM sits in the input stack. In that case I will likely go back to using System Preferences for the better performance, at least for certain actions such as this.

I have the same feeling and it affects my macros.

This is my macro,pretty simple:

I wanna [Title](URL), but sometimes KM gives me this @[Title](URL), which mean the "Simulate 3 deletes before executing" is slower than SP and sometimes went wrong.

1 Like

I tried this just for fun and did see a lag on the first attempt. But subsequent attempts were very quick.

I also tried changing your trigger to make it a little more efficient but that didn't really seem matter:

ss-911

But the "@" was always deleted.

In most case, it runs correctly. :joy:
Maybe is my IME causes this occasional error.

Since we are talking about lag, I notice a lag when copy & paste from one MS Excel worksheet to the other Excel worksheet. I am just copying a 5x5 cells. Similar behavior is noticed when copying from one Word doc to another Word doc. Since I have KM, Alfred and Copied app installed, and I assume they are all having a version of their own clipboard, I wonder if MS is making 3 copies everytime I press CMDC to copy into 3 clipboards. The lag can be annoying when trying to rush to do some work.

I am using a 2017 MacBook Pro Esc with 8GB - maybe this is the reason too.. do you guys notice a lag when copy and paste in Excel?

That may be the issue. Try a simple hotkey trigger.

image


Since you also have a fast Mac, I guess this is a matter of perception (unless the above remark is the cause). I don't notice any lag, certainly not "extremely laggy".

"is pressed" seems the same as "is down". It feels worse really due to not being able to hold down the key, but I think the lag for one press is the same.

KM is not extremely laggy, but it sure feels that way next to the immediate response of System Preferences. That's the problem, that I'm used to one speed and anything slower than that feels laggy.

Try setting it up like I did in the OP. Tab Left using KM, Tab Right using System Preferences.

Cycle through your tabs using both together. I think you'll notice the lag I'm seeing.

OK, I did just that. Here's an animated GIF showing the results.

  • Move Right uses KM Macro
  • Move Left uses native Chrome shortcut

I can't tell the difference.
Both are instantaneous.

Demo-Chrome-Tab-Moves-AN

Really hard to communicate in a gif because the timing is from Finger > Key > Action. If you can't see the finger and keyboard input, you can't see the issue.

Surprised you can't tell the difference, because KM clearly has more lag in practice.

Something must be different on your Mac, because on my Mac, using my Macro, KM does not show more lag.

Did you try using the hotkey trigger I suggested?

OK, maybe this will help. If this does not convince you that there is no lag on my Mac, then I'll stop here.

IAC, I hope you can figure out how to make things work well for you on your Mac.

Previous Front Browser Tab is an AppleScript command. AppleEvents are notoriously slow. So I'm afraid this is not overly surprising.

You could use Select Menu instead of change tab, but that would use the Accessibility API, and sadly, that is also notoriously slow.

Alternatives that might be faster would be:

  • Use the System shortcuts to change the keyboard mapping for moving to the previous tab.
  • Simulate the keystroke to move to the previous tab.

Given that this macro induces the following simulated events from Keyboard Maestro to be added to the event queue:

  • Delete
  • Delete
  • Delete
  • Command-V

There is no way to get “@Title” except by:

  • one of the delete characters getting missed
  • or you typing an extra character after the trigger (eg a space)
  • or the system translating the lj into something else via a system shortcut.

Command-V pasting will often be slower than typing a few characters, but then typing a large number of characters will be slower as well. In either event they will be slower than the system shortcut system which can insert the characters directly into the field without using the clipboard, the menu, or any kind of AppleEvent communication.

This is covered elsewhere. Since Microsoft decided that it would be a good idea to make available an image of anything you copy in about twenty different image formats (including very expensive PDF) every time you copy anything, and since Keyboard Maestro records the clipboard faithfully, there is a lag. Either Microsoft will have to change this, or you will have to exclude Microsoft apps from the Keyboard Maestro clipboard history (Preferences ➤ Excluded) or turn off Keyboard Maestro’s clipboard history (Preferences user manual section), or I will have to adjust Keyboard Maestro to not faithfully record the clipboards produced by Microsoft applications.

3 Likes

I’m pretty fine with this options. Thank you.

Thank you, Peter.

I use Chinese so I have to press Space to choose characters (or choose from list / touch bar)after typing. Maybe this is why I have trouble with the text expansion macro. :joy:

My style of typing is the same as ever, I have been using KM for about 4 months, and this is the first time I encounter this problem. but I do find some rules in the problem: If I typed @l then take a pause before typing j, it will be more steady.

I will consider adding an InputMethod Switcher to my text expansion macro.

I am using the Type a Keystroke action and it is very fast -- NO lag:

image

I also use the KM Action for the NEXT Tab, and again, no lag.

image

1 Like

Well, that would probably do it.

Perhaps change your Typed String trigger to “@lj[space]”?

But I'm not entirely sure how the input works in Chinese, so that might cause other problems.

Personally I use triggers that start and end with an equal sign so they have clear delineation (eg “=em=” for my email address).

It's complicated……in most cases I don't have to press the Space after @lj.

When I write this reply I typed @lj twice and get different texts:

wrong

@[Keyboard Maestro hotkeys are slightly laggy vs. System Preferences Keyboard Shortcuts - Questions & Suggestions - Keyboard Maestro Discourse](https://forum.keyboardmaestro.com/t/keyboard-maestro-hotkeys-are-slightly-laggy-vs-system-preferences-keyboard-shortcuts/13265/18)

correct

[Keyboard Maestro hotkeys are slightly laggy vs. System Preferences Keyboard Shortcuts - Questions & Suggestions - Keyboard Maestro Discourse](https://forum.keyboardmaestro.com/t/keyboard-maestro-hotkeys-are-slightly-laggy-vs-system-preferences-keyboard-shortcuts/13265/18)

Great idea! I will consider changing my "modifier character" to - or =.
AFAIK, these two symbols are the same in English and Chinese (on my MBP).

This works! Changing to the action "Select Previous Tab" in the Menu "Window" entirely eliminates the lag and brings KM in line with the speed of System Preferences.

Seems like Apple Script is causing the lag I'm experiencing. Thanks!