Anki 2.1 look on Plasma 5

sabayon11's Avatar


17 Sep, 2018 12:14 PM

I have a few issues to solve regarding Anki 2.1 look on Plasma 5. I start anki from bin file, I didn't installed it on my system.

  1. I noticed that deck names font is very small. I read
    but I don't know how to apply it when running anki by clicking on bin file. Can I configure a start script or anki.desktop file to make anki adapt some settings?

  2. I use Plasma 5 but I want to try this settings:
    Again, can I configure a start script or anki.desktop file to make anki adapt some settings?

Can similar setting be used for Anki to use Plasma 5 style / theme settings?

  1. I use night-mode add on. I made scrollbar wider but it is somehow moved to the left, it doesn't touch window border:
    I marked in red.
    Also in maximised window.

When I use mouse scroll this is not very important but when I need to click on scrollbar to move it when database have lots of entries it becomes a problem because I have to always check if mouse pointer is places directly over scrollbar. If there was no such space I could just move mouse to the right screen edge and scroll down.

This is in advanced browser mode. In review mode scrollbar touches window border.

Can this be set in this add-on or it is hard-coded in Anki or has something to do with advanced browser?

  1. Support Staff 1 Posted by Damien Elmes on 18 Sep, 2018 01:50 AM

    Damien Elmes's Avatar

    Having the scrollbar touch the side of the screen would not look good on some systems. It behaves differently in the review area because that is a single window, not a combination of widgets.

    You should be able to make a script to start Anki with your preferred options - if you're not sure how to do so, the best place to ask would be on your distro's forums.

  2. 2 Posted by sabayon11 on 19 Sep, 2018 07:44 AM

    sabayon11's Avatar

    For reference. I reported advanced-browser issue:

    the second issue in advanced-browser: sidebar doesn't keep width

    But I have a question: why Anki being qt application doesn't respect qt desktop environment widget style (not even in main Anki window, in review mode)

    I am talking about this: Plasma system settings → widget style.

    I read arch wiki 2

    I installed qt5ct and qt5-styleplugins. Then I run it by:

    QT_QPA_PLATFORMTHEME=qtcurve /usr/bin/anki
    QT_QPA_PLATFORMTHEME=breeze /usr/bin/anki

    but no effect.

    As far as I can remember that with Anki 1 I was able to have consistent look with Plasma widget style using Qt 4 configuration tool qt4-qtconfig but it was KDE 4.

  3. Support Staff 3 Posted by Damien Elmes on 19 Sep, 2018 01:32 PM

    Damien Elmes's Avatar

    The packaged version of Anki includes a complete copy of Qt so you don't have to worry about dependencies. Because it is separate from your distribution's Qt, it may not support all the theming you get normally.

  4. 4 Posted by Glutanimate on 19 Sep, 2018 03:31 PM

    Glutanimate's Avatar

    I looked into this a bit and this is what I found:

    • Up to Qt5.6, the toolkit shipped with a GTK2 platform theme and style (QGtkStyle) which allowed Anki 2.0 to integrate well with Linux DE's (barring the gtkrc tweaks which were necessary sometimes).
    • Qt versions 5.7 and up no longer ship with the GTK2 platform theme and style, instead opting for a GTK3 platform theme (libqgtk3).
    • The GTK3 platform theme doesn't come with a corresponding GTK3 style, and there seem to be no plans to rectify this (if I had to take a guess perhaps it's because of API instability on GNOME's part?)
    • Platform themes control icons & fonts, whereas styles control widget rendering.
    • In the absence of a GTK3 style, Anki 2.1 opts to using the generic Qt Fusion style (which is one of the two generic styles Anki's Qt build ships with. You can list these by typing the following into Anki's debug console: from aqt.qt import *; pp(QStyleFactory.keys()))
    • As a result we're now left in a situation where parts of Anki follow suit with system-wide styling (e.g. fonts, file picker), whereas others don't (e.g. widget styling, colors)

    Distros seem to address this issue in a number of ways:

    • By providing their own optional platform themes and styling plugins. E.g. in case of Plasma 5 you have KDEPlasmaPlatformTheme provided by the package plasma-integration, and the Breeze style provided by the package kde-style-breeze. For GTK3 you have the adwaita-qt style which is used in combination with the QGnomePlatform platform theme.

      On Ubuntu the corresponding Qt plugins may be found under /usr/lib/x86_64-linux-gnu/qt5/plugins

    • By still providing the old GTK2 platform theme and style which are now part of the qt5-style-plugins package rather than the Qt base package.

    (qt5ct doesn't ship with its own styling, but rather allows users to manually override Qt styling and platform themes in case of DEs without Qt integration. Just like the solutions above, qt5ct simply adds a number of plugins to the system-wide Qt installation.)

    As Damien pointed out, Anki ships with its own copy of Qt. As a result, none of the system-wide solutions above will work out of the box. You might be able to symlink some of the plugins of your system-wide Qt installation to Anki's copy of Qt, but this might only work reliably if your system uses the same Qt build as Anki (which will usually not be the case for Arch for instance, as it's on the bleeding edge).


    I understand that this is quite a bit of a mess to deal with, but do you think it would be worth it to explore packaging Anki with additional styles for Linux DEs?

  5. Support Staff 5 Posted by Damien Elmes on 20 Sep, 2018 04:04 AM

    Damien Elmes's Avatar

    Ideally the packaged builds of Anki would integrate perfectly with every desktop environment out there, but I'm afraid it's hard to prioritise work on this over other changes that affect a greater proportion of the userbase.

  6. 6 Posted by Lik Doyaya on 21 Sep, 2018 09:10 AM

    Lik Doyaya's Avatar

    So there is no way to make Anki use a sans serif font here? I find it difficult to read and would love to change it. Does anyone know a way?

  7. 7 Posted by Glutanimate on 21 Sep, 2018 10:57 AM

    Glutanimate's Avatar


    I was afraid you might say that, but I understand. Here's to hoping that the situation improves on Qt's side in the future.


    Hmm, that's weird. Anki should use the system default font (it does so for me on Kubuntu 18.04 and Ubuntu 18.04).

    What output do you get if you enter the following into Anki's debug console?:

    from aqt import mw

    Also: Which distro / desktop environment are you using? Do other Qt5 apps look fine?

  8. 8 Posted by Lik Doyaya on 21 Sep, 2018 01:43 PM

    Lik Doyaya's Avatar
    >>> from aqt import mw
    ... pp(
    'Sans Serif'

    I am using Anki on Arch Linux and a self-assembled environment based on Openbox.
    Other Qt5 programs look fine, using QT_QPA_PLATFORMTHEME (I use qt5gtk2 as the platform theme).

  9. 9 Posted by sabayon11 on 22 Sep, 2018 08:51 AM

    sabayon11's Avatar

    I have:

    >>> from aqt import mw
    ... pp(
    'Droid Sans'

    which is what I set in Plasma settings. But font size is smaller then 12 (as compared to 12 size in LibreOffice Writer).
    But when I changed font in system settings to Noto Sans, Anki still shows Droid Sans, so it looks like it is independent from system font settings.

    By the way, I read in arch wiki about Qt Style Sheets

    $ qt_application -stylesheet style.qss
    Perhaps this may be a solution to Anki styling? Would it be enough to copy Plasma widgets style to this file?
  10. 10 Posted by sabayon11 on 10 Nov, 2018 11:30 AM

    sabayon11's Avatar

    I applied Plasma 5 Breeze Dark theme to Anki installed from source following the advice from here

    But I found that there is some inconsistency in the look of scrollbars:
    1) Browser view
    scrollbars from sidebar and on the right area are from system theme while edition area are different
    2) add-on pop-up windows has correct system settings looking scrollbars
    3) Add window has incorrect scrollbars
    Also review mode has this incorrect scrollbars.

    Is there any explanation for this? can this be fixed?

    I switched off night-mode and advanced browser add-on before taking screenshots. I use Breeze Dark system theme on Manjaro Linux.

    I should mention that fat blue scrollbars are result of using qtcurve. The question is why some parts of Anki respect it, some don't.

  11. Support Staff 11 Posted by Damien Elmes on 11 Nov, 2018 11:48 PM

    Damien Elmes's Avatar

    Anki uses a web engine for half of its interface, and that component appears to do its own handling of themes.

  12. 12 Posted by sabayon11 on 12 Nov, 2018 07:35 PM

    sabayon11's Avatar

    I know you have priorities but are there any chances that someday it will be possible to compile Anki with some options, so that web engine will ignore its handling of themes and let Anki to use system theme?

  13. Support Staff 13 Posted by Damien Elmes on 13 Nov, 2018 05:58 AM

    Damien Elmes's Avatar

    As I'm not involved in WebEngine development, I'm afraid it's not really something I have insight into or control over.

Comments are closed, but you can start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac