Anki Forums

AltGr shortcuts

Hello,
Anki (even without any add-ons enabled) doesn’t seem to accept those characters whose key combination includes “Alt Gr”.
I’m using an Italian keyboard and I can’t input “€” (Alt Gr + e), for example. It simply does nothing.

1 Like

They don’t work even if I use Ctrl + Alt instead of Alt Gr.

Are you reporting an issue specific to this alpha build, or just a problem in general? Perhaps your report is related to the following add-on? https://ankiweb.net/shared/info/1786482670

Thank you for your reply, Damien.
I don’t use that add-on, and in addition the latest alpha behaves this way even after having been started with shift held down.

To confirm, is this an issue you are experiencing only with the alpha version, or does it happen on older Anki versions as well? There are some known issues with the AltGr key, which the above add-on can work around.

I’ve just tried with Anki 2.1.26 and I have no problem typing “€” or “{” (Alt Gr + Shift + è).

Ok, thanks for confirming - it sounds like a toolkit regression. I imagine the -alternate beta works then?

Yes, I’ve just tried and the alternate version works as expected.

Ok, looks like a fix is slated for ~ August: https://bugreports.qt.io/browse/QTBUG-83710?jql=text%20~%20altgr%20ORDER%20BY%20created%20DESC

1 Like

Ok :+1:

Just wanted to confirm the problem. Platform is Windows, Keyboard German. I cannot input any keys that require Ctrl+Alt / AltGr. Tested the alternate version, it doesn’t work there as well.

Does setting the following environmental variable before starting Anki help?

QT_QPA_PLATFORM=windows:altgr

1 Like

Yes! Thank you, indeed that does the trick.
Edit: Ctrl+Alt does not work still though.

Continuing the discussion from AltGr shortcuts:

Hello Damien,

I am using portuguese keyboard on win 10 and had the same problem with AltGr after updating to 2.1.28,

I’m not that experienced in programming and so I don’t know where (file or cmd.exe or somewhere else) / how can I define the environmental variable:

Can you please help me?

just for fun/ knowledge here are the characters I can’t use €@£§{}[] ä

Thank you for keeping Anki updated
André Feliciano

Not dae but

Put the following in a file with the extension .bat (something like anki.bat):

set QT_QPA_PLATFORM=windows:altgr
start "Anki" "C:\Program Files\Anki\anki"

Make sure to change C:\Program Files\Anki\anki if you have Anki installed in a different folder.
Then double click the file to launch Anki.

5 Likes

Thank you, @abdo for your help!

It solved the problem.

And created a minor one :sweat_smile:: Because it’s not an app (being .bat) I can’t put it in my task bar / start menu.

I put it on the startup folder on my pc so it should work, but if I close it I’ll have to go to the desktop.

I question if there is a way of defining variables before opening Anki

Suggestion / question: Just like when you press Shift+Click to open without Add-ons, is it possible to add a combination like Ctrl + Click to allow to define some variables before opening?

If yes, is it possible to then make some of that variables permanent (until next update for example)?

With best regards,
André Feliciano

Alternatively, you can create a shortcut and supply the above commands as the target with some modifications:

  • Right click on somewhere on the desktop > New > Shortcut
  • You’ll be prompted to provide the target of the shortcut. type C:\Windows\System32\cmd.exe /c "set QT_QPA_PLATFORM=windows:altgr & start "Anki" "C:\Program Files\Anki\anki", click Next, then type a name for the shortcut; anki.
  • Optionally, you can change the icon of the created shortcut, by going to its properties and clicking Change icon... then providing the path of Anki: like C:\Program Files\Anki\anki.exe. This should show you Anki’s icon to choose. Just select it and click Ok.
  • You should now be able to put the shortcut in the task bar.
4 Likes

Thank you a lot for solving my major and minor problem, @abdo!

Hope you have a great week! :smiley: :pray:t2: :bowing_man:t2:

2 Likes

I just tried it out and find out that it works best with the “” like this:

… /c set “QT_QPA_PLATFORM=windows:altgr” …

2 Likes

An update for other people linked here:

  • The standard build of 2.1.29 includes the AltGr workaround, so no special action is required if you use the AltGr key
  • If you use Ctrl+Alt instead of AltGr on Windows/Mac, you will need to use the alternate build.
2 Likes