KDE apps can't use dark theme on Cinnamon

Distro: Linux Mint 20.3 Cinnamon 64-bit
Flatpak version: 1.12.2.
Issue: I want Flatpak apps to use the same dark theme as my host system. I have Cinnamon set to use the “Mint-Y-Dark” theme. I installed the flatpak theme org.gtk.Gtk3theme.Mint-Y-Dark from Flathub, and all GTK apps automatically use it, but apps using the KDE runtime don’t.

Following the advice of the Flatpak docs, I installed org.kde.PlatformTheme.QGnomePlatform//5.15-21.08 and org.kde.KStyle.Adwaita//5.15-21.08 from Flathub.

Far from fixing the problem, installing these runtimes results in all KDE apps being unable to launch!

flatpak run com.obsproject.Studio 
Gtk-Message: 15:53:26.231: Failed to load module "xapp-gtk3-module"

(obs:2): GLib-GIO-ERROR **: 15:53:26.254: Settings schema 'org.cinnamon.desktop.interface' is not installed```

All other apps using the KDE runtime produce the same error.  For example,

flatpak run org.kde.kolourpaint
Gtk-Message: 15:59:05.626: Failed to load module “xapp-gtk3-module”

(kolourpaint:2): GLib-GIO-ERROR **: 15:59:05.649: Settings schema ‘org.cinnamon.desktop.interface’ is not installed```

Uninstalling QGnomePlatform but leaving org.kde.KStyle.Adwaita allows KDE apps to launch, but they still don’t use my system’s dark theme. Installing QGnomePlatform but not KStyle.Adwaita gives the same issue as installing both.
org.cinnamon.desktop.interface does not seem to be a flatpak app or runtime, so I don’t know how to fix it.

Can you try changing the theme of your host system to Adwaita-dark and then open the app again?

org.kde.PlatformTheme.QGnomePlatform is enough in my case.

In the Cinnamon theme settings, I changed the “controls” theme to Adwaita-dark, and the “icons” theme to Adwaita (Adwaita-dark is not presented as on option). There doesn’t appear to be any Adwaita option for the “windows borders” or “desktop” theme.

I also installed the Adwaita-dark theme from Flathub.

It didn’t make a difference, I get the same error.

I also tried installing Mint Mate in a virtual machine to see if this issue reproduced, and it didn’t: KDE flatpak apps could launch even with org.kde.PlatformTheme.QGnomePlatform installed (although they didn’t use the Mint Dark theme). So whatever is causing the apps to not launch is present in Mint Cinnamon but not Mint Mate.

Are you using Wayland? If yes, can you try x.org?

I’m using X.Org (Cinnamon doesn’t support Wayland yet.)

Setting

export QT_QPA_PLATFORMTHEME='gnome'

as an environment variable could be the solution.

How do I do that? I can’t figure it out from the flatpak docs.

Just add it to the environment variables in Flatseal.
You can also try something with QT_STYLE_OVERRIDE=....

I tried:

QT_STYLE_OVERRIDE=‘gnome’

and

QT_QPA_PLATFORMTHEME=‘gnome’

for OBS Studio and it didn’t make a difference. Flatseal says

export QT_QPA_PLATFORMTHEME=‘gnome’

isn’t a valid enviroment variable, so I also tried

export_QT_QPA_PLATFORMTHEME=‘gnome’

and that also didn’t work.

OBS Studio is using its own theme: File > Settings > General > Theme.
Try the environment variables with other KDE apps please.

I tried it with KolourPaint. No difference.

On the Mint forum, Linuxed suggests using

flatpak install flathub org.kde.KStyle.Adwaita
sudo flatpak override --env=QT_STYLE_OVERRIDE=Adwaita-Dark

and that works for me!