musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.31k stars 2.66k forks source link

[MU4 Task] Preferences > General > Keyboard layout not yet working #12223

Closed cbjeukendrup closed 2 years ago

cbjeukendrup commented 2 years ago

This setting is not doing anything yet. The question is whether we still need it, and what it should do.

Tantacrul commented 2 years ago

Assigning to @bkunda to investigate and recommend (since you've dealt with similar stuff to this before)!

shoogle commented 2 years ago

I checked MuseScore 3's source code. The keyboard layout setting was only used to determine which set of keyboard shortcuts would be loaded:

(There were different non-AZERTY shortcuts for PC and Mac but that was handled separately to keyboard layout.)

So it appears that we don't need a huge list of keyboard layouts in MuseScore 4. All we need is a choice between:

I could imagine this setting being called "Shortcut profile", with more options added later on, such as a "Classic" profile based on shortcuts from MuseScore 3, or profiles based on shortcuts from other notation software (something @Tantacrul has mentioned in the past).

shoogle commented 2 years ago

AZERTY keyboards

For those interested, the main difference with AZERTY keyboards is that they don't have dedicated number keys, so you have to press Shift with another key to enter numbers. Thus our shortcuts to change note duration would be entered as follows:

Duration shortcut Non-AZERTY AZERTY
Eighth (quaver) 4 Shift+' [= 4]
Quarter (crotchet) 5 Shift+( [= 5]
Half (minim) 6 Shift+- [= 6]

That's fine so far and doesn't require a separate set of shortcuts for AZERTY users. When the keyboard layout is AZERTY, the operating system converts Shift+( to 5 automatically causing MuseScore to enter a quarter note.

However, to make life easier for AZERTY users, we have chosen to also allow the relevant keys to be pressed without Shift:

Duration shortcut Non-AZERTY AZERTY option 1 AZERTY option 2
Eighth (quaver) 4 Shift+' [= 4] '
Quarter (crotchet) 5 Shift+( [= 5] (
Half (minim) 6 Shift+- [= 6] -

It is the fact that we provide this second option just for AZERTY users that means we need to maintain a separate set of shortcuts just for AZERTY users.

Apart from this difference due to number keys, AZERTY shortcuts are pretty much identical to the non-AZERTY shortcuts, which makes me think that the AZERTY shortcut profile should store only the differences from the standard profile.

bkunda commented 2 years ago

Thanks for this very helpful summary @shoogle!

I can now see that my original designs for exposing/relocating the "keyboard layout" settings in Preferences > General should be reconsidered, especially since a) we really only need two "out-of-the-box" options, and b) these options determine only which set of keyboard shortcuts should be loaded (meaning they really should be available in Preferences > Shortcuts, which is already a very "full" screen and would needs some of its layout/UX rethought in order to accommodate any further settings).

Given all this, and the fact that we are about to enter the beta release stage, I'm going to suggest that we postpone implementing a "keyboard layout" setting until 4.x. This is because it would be preferable to solve this problem more comprehensively by, for example, implementing a "shortcuts profile" setting in Preferences > Shortcuts instead, paving the way for more custom shortcut profiles to be introduced later on. This would also be a neater way of enabling AZERTY users to quickly change their shortcuts profile.

I'd therefore suggest closing this issue for now and working instead on improving the messaging we have on musescore.org so that the instructions for AZERTY users to download the relevant shortcuts_AZERTY.xml file are as simple as possible. Obviously, this is certainly not as good as being able to choose this option from within the app itself, but we cannot unfortunately add anything to our user flows at this stage in the release period, and I'd like to ensure that the solution we do end up implementing is properly considered.

jeetee commented 6 months ago

Sidenote as a Belgian Azerty user; there are different azerty layouts as well (and qwertz / bepo / dvorak / ....). I'm not sure to what end having separate default files for each of them is workable (even though I contributed to the MS3 one). It might be interesting to check in how far the Qt system allows for plain symbols (such as hyphen and curly braces) to be detected on all of those layouts regardless of the sequence required to enter them.

The only "useful additional" really difference I see are the numeric shortcuts for duration, which indeed required Shift on my end to work on a laptop without numeric keypad. Non-shifted versions might result in some conflicts, such as the parenthesis being the non-shifted version of 5 on my layout.

cbjeukendrup commented 6 months ago

I believe Qt's default is to do keyboard shortcuts by character. In MuseScore 4, we hacked around that to do it by key combination instead. Reason: when switching to for example a Cyrillic keyboard layout, basic letter shortcuts like Ctrl+A don't work anymore, because that becomes Ctrl+[some Cyrillic character]. However, as has become clear, this approach has other negative effects for non-letter shortcuts.

So I think we should go for a hybrid approach. Letter-based shortcuts should go by key combination, while special-character-based shortcuts should go by character. Or, even better, make it possible to specify per shortcut whether it should be interpreted by key combination or by character. That's easier said than done, though.