To interpret key commands, Dorico seems to be checking for specific characters. For example, if I use an English keyboard layout, Shift-N works. But if I switch to a non-latin layout, Shift-N doesn’t work because N key doesn’t produce N character anymore.
When coding native macOS apps in Apple’s own AppKit framework, we can check for a virtual key code instead for a character. For example, a virtual key code of the physical key N is 45 and it remains 45 even when we switch to a completely different layout. And we can do something like (pseudo-code)
Interesting request, but I’m a bit confused as to why one would switch (I’m assuming the same keyboard peripheral) to a different keyboard layout. In particular on a Mac, it’s fairly simple to input non-latin characters without even having to lift your fingers off the keyboard.
The way I understand how these popovers work is via mnemonics (I think that’s the right term). They’ve been pretty consistent, N=note input, X=text, O=ornaments etc., not, 7th key, 5th row (latin keyboard ‘N’) – even though both are code 45.
… or perhaps I’m misunderstanding what you actual mean.
The short answer to the original question is “no”.
I’m sure that using the information provided by Qt it would be possible to uncover the original keycode, but the whole point of using a framework like Qt is that these details are abstracted away in a useful fashion. The fact that you can (on the whole) use the same key command file on Windows and macOS is very handy.
This is very interesting to learn, in light of the Korean-keyboard hyphen issue last week! Just as a matter of curiosity, was my diagnosis there wrong?
Daniel already replied it’s likely not possible with Qt, but let me explain why it would be useful.
I have a laptop with standard US keyboard layout, which is sold in my region. But when I type in Cyrillic script (for example, to input lyrics), I have to switch keyboard layout. There is no easy way to input Cyrillic characters without switching keyboard layout, as far as I know.
With the layout switched, I can still use system shortcuts (Cmd-C, Cmd-V etc). I can also still use any Dorico-specific shortcut that contains Cmd modifier. That tells me that those shortcuts are autmatically interpreted using virtual keys and not characters (which means Cmd-D is always Cmd-D, even if I input Cmd-Д).
But I can’t use any key command that contains only letters or Shift + letter combination. Apparently, commands that do not contain Cmd (or control or option) are interpreted through text. So Shift-D is not the same as Shift-Д. For this kind of shortcuts I have to switch back to US layout and then again switch to Cyrillic layout to continue typing text.
Well explained. A better method for this is to write your lyrics (with hyphens) in a separate program, Copy them all, and Paste them into the popover in Dorico. They go in one syllable at a time, so you can extend a syllable when needed.
This is a bit of a stab in the dark, as I am not really experienced with this feature, but I am reminded here that there is a “Keyboard language” option in the keyboard shortcuts section of Preferences.
Having had a quick look, it appears that features can have different assignations for each of the supported languages, including having a shortcut only in a subset of all languages. Might this be related to your issue?
This reminds me — It is possible to create a custom keyboard layout that generates e.g. Cyrillic text but QWERTY with the ⌘ key, all in one. Ukelele is a good editor for this.
But it’s very detailed work, and custom layouts may need to be updated with a future OS update. The separate window & paste method is simpler and more durable.
[Edit:] And I was forgetting that we need lots of Shift-keys for Dorico commands!
Keyboard language preference is definitely related to the issue, but it doesn’t really do what I would like and expect.
For example, choosing Russian as a keyboard language makes Create Lyrics be Shift-Д, which is equivalent of Shift-D. I don’t understand the logic behind this. I would expect it to become simply Shift-Л (equivalent of Shift-L).
Simply put, I would like if Dorico could ignore keyboard layout I choose in Keyboard Settings and treat my keyboard as a US English keyboard what it physically is. That is possible in native AppKit framework, but apparently not in Qt and not in a cross-platform way. It’s not really a big deal anyway.
I’ve just noticed something interesting. All the system shortcuts in macOS are layout-independent. They just work. However, it is not possible to set a system shortcut that uses Shift as the only modifier.
Most native macOS apps do not use Shift-only shortcuts either. But Logic Pro does use them and like in Dorico, those that are Shift-only do not work with non-latin layouts. So this is not specific to Dorico or Qt.
It actually makes a lot of sense. Shift + letter is used to type capital letters, so letters pressed after Shift must be interpreted as characters.
However, other modifiers are not used for text input, so letters pressed after those modifiers are interpreted as physical keys.
It looks like Shift+letter was originally intended only for text input, but that was unfortunately never standardised.