[Sway] Qt (Okular) style problem

I am using Sway and feel like I finally set my themes properly, my apps are dark mode properly. Except for Okular (KDE’s pdf reader)

I use Kvantum to make my Qt apps look good (KvArcDark is the style I use, as Arc-Dark is what I use for GTK)

When I open Okular, it looks like this:

However, when I go to ‘Settings > Colour Scheme’, change to anything and back to Default, it looks correctly:

I use QT_STYLE_OVERRIDE environment variable set to kvantum to set my Kvantum style.

What could be the cause?

Thanks in advance.

Do you have qt5ct and qt6ct installed?

My environment variable for Qt apps is set to use QT_QPA_PLATFORMTHEME=qt6ct and it works as expected for me. In both, set them to use kvantum for the style.

To clarify:

sudo pacman -S qt5ct qt6ct

Add QT_QPA_PLATFORMTHEME=qt6ct to /etc/environment.

sudo nano /etc/environment

Open both qt5ct and qt6ct, set them to kvantum for the style, then finally, log out and log back in, or reboot if necessary.

Yes, they are installed. With QT_STYLE_OVERRIDE unset and QT_QPA_PLATFORMTHEME set to qt6ct it looks the same. They are both set to kvantum.

What I noticed is the look I get when opening Okular is the same as Breeze Light theme. So I guess it loads this theme? But the option selected in Colour Scheme is ‘Default’

Do they (qt5ct/qt6ct) show you an error message?

Also, is the theme actually installed in /usr/share/themes or /usr/share/kvantum/ (can’t remember where Kvantum stores themes)?.

No, no error message; no, I don’t see them in /usr/share/themes and /usr/share/kvantumdoes not exist. I set the theme in Okular manually to KvArcDark and this works, but I would still prefer it to work with Default setting.

Just checked. If you have Kvantum installed, you should have /usr/share/Kvantum.
I changed it to a capital K, in case you were using a terminal.

In any case, I find that Kvantum/Qt/KDE prefers to have the theme fully installed sometimes to work properly. So, if you only have the themes in your /home/.themes/ or /home/.config/ or /home/.local/share, it may not recognize them properly.

KvArcDark is present in /usr/share/Kvantum

[halvar@marek-ms7e56 ~]$ ls /usr/share/Kvantum/KvArcDark/
KvArcDark.kvconfig  KvArcDark.svg

The only other thing I can think of at the moment is setting an application theme in Kvantum for Okular. Not sure if this will work, and even if it does, it then means if you change your overall theme to something else, you’ll have to manually change Okular’s via Kvantum again.
And this is something you can easily forget that you’ve done. Speaking from experience, unfortunately. :sweat_smile:

No, I didn’t set any exceptions in Kvantum. What worked is in Okular settings setting the theme to “KvArcDark” instead of “Default” which doesn’t answer my question but solves the issue

I didn’t mean that you should check if you set an exception. I was suggesting that you go and set one to see if it forces Okular to use the theme you want it to use without having to set it manually each time you open Okular. This is the issue, right — each time you open Okular you have to set the correct theme?

As far as the cause is concerned, it could be so many things. Generally, no theme is better supported than Breeze (KDE/Qt) and Adwaita (Gnome/Gtk), so you are more likely to have trouble with random apps as a result. This happened to me with Dolphin using the incorrect border decorations after changing my theme to something other than Breeze Dark. And with Kate/KWrite having the exact same issue as you are having with Okular.

No, it doesn’t; looks like custom theme in Okular settings is staying

This is what I mean:

Is this what you tried based on my previous reply?
In this case, you’d select your preferred theme, then type “okular” into the box.

yes, this is what I tried.

What is in the following files?

cat .config/Kvantum/kvantum.kvconfig
cat .config/okularrc

The first should be your preferred theme, and the second should say Kvantum.

kvantum.kvconfig

[General]
theme=KvArcDark
- - -
okularrc

[UiSettings]
ColorScheme=Kvantum

Now it works, the problem was the second file. For some reason Okular’s ‘Default’ theme is not default Qt theme of the system, but something else. I set its theme to Kvantum and it works

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.