Answer hotkeys not working with fcitx

I recently had to upgrade from anki-2.1.15 to version 2.1.54 Qt6 released on the Anki website due to python updates breaking the distro release. The state of the Anki build system is so convoluted, that the Gentoo developers didn’t seem to want to bother bumping up the version, so I’m stuck with the prebuilt binary from the website for now.

Just one issue. After I type something in japanese into input fields, the hotkeys stop working. I have to disable the fcitx input method to use the number keys 1-4 for answering. This functionality was fine with the version 2.1.15, so something has clearly happened in between. Not sure if its the Qt upgrade or something else, I can’t really get any more details out of it other than “it just doesn’t work”.

This is the CLI output when I run Anki from the terminal

Anki starting...
Initial setup...
Running with temporary Qt5 compatibility shims.
Run with DISABLE_QT5_COMPAT=1 to confirm compatibility with Qt6.
Preparing to run...
Qt info:

GL Type: desktop
Surface Type: OpenGL
Surface Profile: CompatibilityProfile
Surface Version: 4.6
QSG RHI Backend: OpenGL
Using Supported QSG Backend: yes
Using Software Dynamic GL: no
Using Multithreaded OpenGL: yes

Init Parameters:
  *  application-name Anki
  *  browser-subprocess-path /opt/anki-2.1.54-linux-qt6/lib/PyQt6/Qt6/libexec/QtWebEngineProcess
  *  create-default-gl-context
  *  disable-features ConsolidatedMovementXY,InstalledApp,BackgroundFetch,WebOTP,WebPayments,WebUSB,PictureInPicture
  *  disable-setuid-sandbox
  *  disable-speech-api
  *  enable-features NetworkServiceInProcess,TracingServiceInProcess
  *  enable-threaded-compositing
  *  in-process-gpu
  *  use-gl desktop

xkbcommon: ERROR: Unrecognized RMLVO variant "qwerty" was ignored
Starting main loop...
conf key heatmap should be fetched with col.get_config(), and saved with col.set_config()
conf key heatmap should be fetched with col.get_config(), and saved with col.set_config()
conf key heatmap should be fetched with col.get_config(), and saved with col.set_config()

Some other information that might be beneficial:
fcitx version: 4.2.9.7
distro: Gentoo
Anki Versio ⁨2.1.54 (b6a7760c)⁩
Python 3.9.10 Qt 6.3.1 PyQt 6.3.1

Yes, and Gentoo is not the only distro. In fact, AFAIK, only a (very persistent) Arch packager has achieved properly packaging Anki (as opposed to some distros that have a package that only fetches the binaries).

IIRC, this is a Qt issue. Downgrade to Qt5, and it should work (Anki also provides Qt5 binaries for 2.1.54).

I actually also tried the Qt5 binary, but it had way more issues. Mainly it had problems rendering stuff. The entire deck list was missing. The only thing that it showed was the top bar with the drop down menus

Do you have an NVidia card? If so, do you use nouveau?

I have a 3000 series nvidia graphics card and I use the proprietary drivers. Nouveau doesn’t support Ampere yet and can’t even reach the desktop

Do you use Wayland?

Nah, wayland crashes immediately on launch with my graphics card

This is what the Qt5 version of Anki looks like on my system.
anki_launch

I had a similar experience with Anki on a computer which had an NVidia gpu… when I worked under X11, it all went fine, but as soon as I moved to Wayland (with Nouveau), starting Anki was one of the most dangerous thing to do (it randomly completely and utterly made my computer freeze to death…), moving on with proprietary drivers was much more stable, but it still showed this kind of behavior. Now I just don’t use Anki on that computer anymore with Qt5 :confused: Qt6 worked better.

Actually it looks like wayland has started to work on my machine. Had forgotten to compile the nvidia-drivers with wayland support. Previously this didn’t help, but some magic seems to have happened during the past few months.

I’ll see if wayland would work any better. If it doesn’t, gonna have to find a solution from some place else

If you use sway, yes, some magic has happened: previously, NVidia proprietary drivers were closed-source (and, NVidia’s attitude was… well, Linus Torvald puts it nicely). Similarly to Torvald, sway’s developer did say it was not his responsibility maintaining NVidia’s mess, and added an option called --my-next-gpu-wont-be-nvidia (I’m not kidding) to prevent sway from instantly exiting if it detected NVidia’s proprietary drivers (which didn’t prevent it from crashing due to lacking compatibility, though).

However, some time ago, NVidia open-sourced their drivers. Hallelujah! The aforementioned option turned into --unsupported-gpu and, contrary to what the name might let think, the support is now actually pretty good (even though that took some time after NVidia open-sourced their code). You still get a flashy red warning when you start sway, and I personally experience some flickering (especially when the gpu is under heavy load — which doesn’t happen that often), but besides that it works (which is a big step forward).

Also, I heavily discourage using Nouveau with wayland and Anki, that gave (by far) the worst result for me, making it impossible to use Anki, since as soon as I launched it, each second I had a chance to kill my computer forcing a hard shutdown (even ssh didn’t work…).

For the blank main window, maybe Blank Main Window - Anki Manual

1 Like
QTWEBENGINE_CHROMIUM_FLAGS="--disable-seccomp-filter-sandbox" ./anki

fixed the issue and also the keybind problem seems to be gone with the Qt5 version. Thanks for the help both of you :+1:

1 Like