Emulating low level key press events

Is it possible to have KM generate low-level keyboard events.

Currently, if I have a macro the simulates pressing the D key and I go into Discord, and start typing a message and trigger the macro, I get a nice D in the message. However if I go try and record a key bind, and trigger that macro, Discord never sees the key press.

I have several apps that seems to work the same way, they only respond to keypress events from real keyboard. Simulated keypresses from KM (or StreamDeck, etc) don't seem to trigger things looking for keypress events.

Welcome to the forums! Hopefully we'll be able to help, but to make that easier, can you explain what you're trying to get KM to do in Discord? I'm not sure I understand "record a key bind" in this context.


Thanks for the welcome Rob..

Discord allows you to bind a key to a Discord action. For instance, you could bind Right Ctrl to trigger the Push To Talk action.

Using the Karabiner Event Viewer, I noticed keypress events when I type on my actual keyboard, but when KM simulates a key press, the character will appear in a text doc, but no key events show in the Event Viewer.

I have Discord, but don't use the voice features, so haven't ever looked at that side of it. It sure looks like they're doing some very weird thing to trap those keys, as you're right, you can't send them from Keyboard Maestro.

I also tried from one of our apps (Butler) that can send keystrokes; no luck there either. Whatever they're doing exists solely within Discord, somehow. I think you're out of luck, unless someone else has some trick that I'm not aware of—Discord just won't register keys sent with modifiers from other apps, it seems.


I recall once I had to find a low level mouse click utility because the KM mouse click wasn't working on some app, and I found a small, free utility that would emulate a click at the current mouse location, and it worked when KM's "click mouse" action didn't. With the right utility, this trick could also work on keyboard clicks. However I just searched for 5 minutes to find one, and didn't find one. I believe one of the keywords you should use in a search is "Quartz event."

If you are really desperate, for perhaps $10 you could buy one of those USB sticks that emulates an HID device like a keyboard. I haven't had one for ten years, but I remember programming it to send USB HID signals to my Mac. I can't remember what I was doing that for. These devices are often used by hackers (eg, they plug the device into a computer that is already logged in), so people might question why you have one. These devices have a bad reputation, as they are often used to hack people's computers. But this can't be taken too seriously, as a Raspberry Pi Zero ($20?) can do the same thing, (it's called "USB Gadget Mode") and nobody has called Raspberry Pi's an evil hacker tool.

Hmm, I see a new development. The "Raspberry Pi Zero W" has Bluetooth support. This might mean you can control it using Keyboard Maestro through its wireless protocol, and it will generate hardware events indistinguishable to any app from a real keyboard or mouse. For more information on USB emulation, check this page:

I had a second thought, that maybe AppleScript worked at a lower level, but it does not. This script does nothing in Discord either:

tell application "Discord" to activate

delay 1

tell application "System Events"
	keystroke "a" using {shift down, command down}
end tell

(Shift-Command-A was my test key bind.)