Keystroke Typing Action Changes Value after I manually change my keyboard layout

Hi there,

I have a macro that depends on triggering the Keyboard Shortcut Cmd + Y. I usually use a German Keyboard Layout and everything works fine. But once I switch to an Icelandic Keyboard Layout, my Keystroke Typing Action in KM changes automatically to Cmd + Z instead.

To demonstrate. Before (german keyboard layout):

And after (icelandic keyboard layout):

This all happens without me doing anything except changing the keyboard layout manually. Obviously this messes with my macro. So the question is: How can I prevent this and make sure my Macro always triggers Cmd + Y?



Hm, I saw those threads, but they still do not solve my problem. Also, it seems to me that @peternlewis 's statement

Hot Keys are based on key codes, and key codes pay no attention keyboard layout.

does not apply to my issue. Unless I am misunderstanding something. But if I have an Keystroke Typing Action set to Cmd + Y and then change my Keyboard Layout to another language, the Keystroke Action should certainly still trigger Cmd + Y, especially if the Action is based on Keycodes. Or not?

The Type a Keystroke action is like the Hot Key trigger, it types based on keycodes.

So the Type a Keystroke action with ⌘Y, after a changed layout, will likely type a different command key (generally whatever letter is now on that physical key).

1 Like

Ok, then I acutally misunderstood your statement.

But doesn't that mean that if I prepare a macro that types ⌘Y on my German keyboard layout and then share it with the world that it would trigger incorrectly (acutally triggering ⌘Z) for anyone who has an English keyboard? I find this hard to believe.

Either way, is there a way to work around this? Is there some way/action to reliably detect currently selected keyboard layout?

Why do you want to type command-y? Chances are you could use an entirely different action instead

I need to trigger the Quicklook Preview in Finder.

Space bar does not work in my particular case and I cannot trigger it via the menu entry, as the menu action's name always changes depending on which file is selected. Also I did not find any way to trigger this via Applescript.

I can see why you would think so, as this isn't easily discoverable, but it is actually possible to trigger Quick Look via the menu entry just by adding a caret (^) at the start:

Adding the caret makes KM use regex to match the menu entry, so as long as the File menu contains an entry with "Quick Look," it will work no matter what comes after it.


Wow, thanks, this is perfect and solves my specific problem. Thanks a lot!

(although I am admittedly still confused by the initial problem)

1 Like

Correct. Keycodes, as used in the Type a Keystroke action and the Hot Key trigger are independent of the keyboard layout - so if you change the keyboard layout, the keycode remains the same, and the keycap has likely changed.

You can detect the current layout with the KeyboardLayout token.

1 Like