Customize Keyboard Shortcuts

It’s not a trivial issue: people with international keyboard layouts just can’t use some of the predefined keyboard shortcuts for some commands(for example, the @ symbol to suspend card) and must use the mouse instead.

Yes, I know that there are some addons just for that (for example, Customize Keyboard Shortcuts - AnkiWeb ), but some of us try to avoid installing addons, and it would be just great if this function would be implemented in the main program.

Thanks for considering.

2 Likes

Shortcuts should listen to actual keys rather than the characters produced by the keys, which I think would solve this issue easier.
So rather than listening to “@”, it should listen to “Shift+2”. However it seems this is not possible with Qt. But it is possible, if we integrate the shortcuts into the web view. I will prepare a patch to Anki for this :slight_smile:

Do you have any other windows other than the reviewer, where you noticed this?

3 Likes

Thanks very much!

The @ - suspend card has been the only non-working shortcut I’ve found until now (I’m using a spanish keyboard layout), but I will take a look and report if I find another one, for sure.

@hengiesel
Thanks for taking on this, just for your information: I played around a bit and the “@” character actually arrives in the event loop for a non-English keyboard layout (at least when an event filter is installed). Maybe there’s a good reason for not using this in Anki though, I didn’t look at how the shortcuts are currently implemented.

Hi, @hengiesel , any news on this? :slight_smile:

Solved from 2.1.50 (Qt 5.15.2)

@cqg so the problem doesn’t happen in beta 2 on the qt5 or qt6 build? Could you please try something for me?

If you edit anki-console.bat in the Anki program folder, and add this line at the top:

set QT_QPA_PLATFORM=windows:altgr

Then start Anki with that .bat file, does that cause the problem to come back again?

Yes, the problem doesn’t happen in either qt5 or qt6, but starting the program with the altgr setting brings the problem back in both versions.

Thanks for confirming that. Unfortunately it’s bad news :slightly_frowning_face: That option was going to be the default in the next beta, as it solves this problem: AltGr issues on Anki Windows. AltGr + 4 for $ and AltGr+2 for @ do not work - #7 by MedBooster

@cqg @Rumo @hengiesel and others: Since it seems we can’t solve both problems at the same time, am I correct in assuming that we’re better off with the AltGr fix than trying to fix the issue on this thread?

I’d say so, yes.
Suspending is still possible with Ctrl+Alt+Q ("@" is AltGr+Q on my keyboard), so my guess would be that the missing environment variable caused this sequence to be triggered, rather than correctly handling AltGr.

3 Likes

Yes, the problem describred here is not a serious issue at all, but in the long run, would it be possible to implement custom shortcuts, or this is an impossible / unrealistic option?

Also, I’m sure I’m missing something here, but would it be possible to avoid potentially conflictive shortcuts (like the @ or [ symbols) and use more standard combinations instead?

A customize shortcuts feature may come in the future, but is not at the top of the todo list at the moment.

Anki has quite a few shortcuts, and picking “good” ones that resemble the action name and don’t conflict on any platform is trickier than you might expect.

3 Likes