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?
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).
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?
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.
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.