Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configured theme not applying to all applications #38

Open
Scraft161 opened this issue Jan 24, 2024 · 96 comments · May be fixed by #43
Open

Configured theme not applying to all applications #38

Scraft161 opened this issue Jan 24, 2024 · 96 comments · May be fixed by #43

Comments

@Scraft161
Copy link

I've used qt5ct and qt6ct to set custom styles for my qt apps, this works great for most apps and I've been using that.
But there's a bit of snag, KDE Connect and Tokodon seem to ignore the configured style.

An image with "Ark" on the left with the style applied and "Tokodon" and "KDE Connect" on the right with their default styling
Ark left has the theme applied; whilst Tokodon and KDE Connect fall back to their default light theme.

I have noticed that Kde Connect and Tokodon are a bit different compared to other Qt apps with a header bar and more mobile-forward and responsive layout; but I don't see why they wouldn't be styled by the Qt theme.

I can however confirm that this shouldn't be a configuration issue as both Qt5 and Qt6 applications work fine and without any major issues.

@Scraft161
Copy link
Author

little follow-up that provides more information:

I did some digging and apparently both KDE Connect and Tokodon are built with Kirigami, whatever may be the cause is probably in relation to that.
What exactly is at play here, I don't know, but it does seem like a good place to start investigating.

In fact, I found this reddit thread talking about the exact issue at hand; but it doesn't seem to point to anything that could be of use.

@ilya-fedin
Copy link

ilya-fedin commented Feb 2, 2024

KDE uses its own color scheme engine called KColorScheme (ignoring QPalette and Qt theme colors) and Kirigami applications are built on top of QML that qt5ct has no theme control for. The Qt's default for QML applications is the Fusion theme on Linux (just like for widgets) but KDE has its own theme called qqc2-desktop-style that allows applying widgets themes to QML applications. KDE applications are also made for their own icon engine called KIconEngine that applies KDE color schemes to svg icons so when the engine is not used you're likely to see things like black icons on black background.

I have a patch adding KColorScheme/KIconEngine/qqc2-desktop-style support to qt5ct, packages with it are available for NixOS and qt{5,6}ct-kde on AUR.

An important thing is to have a KDE color scheme for your Qt theme and apply it in the patched qt5ct or the result will be screwed as KDE applications use colors from both KDE color schemes and Qt themes. It enumerates such color schemes but doesn't show a difference in preview (as I'm too lazy to implement this, it's good for me as is).

In an ideal world, KDE applications should apply all the custom theming on their own like Qt applications with branded design do on Windows/macOS but it seems there's no people interested in doing such changes in the KDE coomunity.

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

Kirigami is not the issue, as it also doesn't apply to KDE 6 apps like Dolphin and System Settings using qt6ct.

@ilya-fedin
Copy link

System Settings do use Kirigami. Although you're right that it's not only Kirigami, it's KColorScheme framework which is used by both QML and Widgets KDE apps.

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

But does Dolphin use Kirigami? And Haruna? And Amarok git, built with Qt 6? And Okular? Because it doesn't work in those apps either. And if System Settings only partly uses Kirigami, I'd expect the theme to at least partially apply.

Btw, I tried your patch on Arch Linux with qt6ct from git, but it doesn't solve the issue.

@ilya-fedin
Copy link

As I said, it's not Kirigami but KColorScheme. And yes, all KDE applications use KColorScheme.

Btw, I tried your patch on Arch Linux with qt6ct from git, but it doesn't solve the issue.

Did you choose a color scheme with it that has a (KColorScheme) in its name?

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

But then what changed with KDE 6? Because I never had issues like this with KDE 5 apps.

Yes, I chose Breeze Dark. That's one of the two default KDE themes, so it should be good. Except that it isn't.

@ilya-fedin
Copy link

Yes, I chose Breeze Dark. That's one of the two default KDE themes, so it should be good. Except that it isn't.

Can you provide your Qt-related environment variables? env | grep QT

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

❯ env | grep QT
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_WAYLAND_RECONNECT=1
QT_QPA_PLATFORMTHEME=qt6ct

@ilya-fedin
Copy link

Can you reproduce if you run affected application in that terminal session?

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

Can you reproduce if you run affected application in that terminal session?

Then it seems to work fine.

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

Scratch that: it did apply the correct colors, but not the theming engine.

@ilya-fedin
Copy link

Then it seems to work fine.

So the issue is that you have set QT_QPA_PLATFORMTHEME in a way it doesn't go through all your graphical session

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

Then it seems to work fine.

So the issue is that you have set QT_QPA_PLATFORMTHEME in a way it doesn't go through all your graphical session

Please see my message after that one. 🙂

(And I have set that variable in /etc/environment, just like I used to do with qt5ct.)

@ilya-fedin
Copy link

Scratch that: it did apply the correct colors, but not the theming engine.

Some KDE applications like Dolphin hardcode theme for non-KDE sessions now

@ilya-fedin
Copy link

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

Scratch that: it did apply the correct colors, but not the theming engine.

Some KDE applications like Dolphin hardcode theme for non-KDE sessions now

But I'm using KDE.

@ilya-fedin
Copy link

But I'm using KDE.

Then you don't really need qt6ct? Setting qt6ct would make that logic to think you're using a non-KDE session.

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

But I'm using KDE.

Then you don't really need qt6ct? Setting qt6ct would make that logic to think you're using a non-KDE session.

But using qt6ct I can disable cursor blinking, which is not supported by KDE itself. I was advised to use qt5ct for that on KDE 5, but I clean installed Arch Linux with KDE 6 last week, so now I need to use qt6ct to achieve that. And because of that, I also need to set the theming engine through qt6ct.

@ilya-fedin
Copy link

That logic seem to force the Qt style from kdeglobals so setting it via both qt6ct and system settings should theoretically do the thing

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

Could you explain that a bit more? Like I said: I did use this exact same setup with qt5ct without any issues.

@ilya-fedin
Copy link

Could you explain that a bit more

You don't know how to set Qt style via system settings?

Like I said: I did use this exact same setup with qt5ct without any issues.

As you can see the linked issue in kiconthemes, it's done in KF6, not KF5

@Vistaus
Copy link

Vistaus commented Sep 21, 2024

I have set it in system settings, but it doesn’t make a difference for the majority of apps, including the ones I listed earlier.

@ilya-fedin
Copy link

What those commands return?

grep widgetStyle ~/.config/kdeglobals 
grep style ~/.config/qt6ct/qt6ct.conf

@Vistaus
Copy link

Vistaus commented Sep 22, 2024

❯ grep widgetStyle ~/.config/kdeglobals 
widgetStyle=qt6ct-style

~
❯ grep style ~/.config/qt6ct/qt6ct.conf
style=kvantum
stylesheets=@Invalid()
toolbutton_style=2

~
❯ 

@ilya-fedin
Copy link

Could it be that you have kvantum installed only for Qt 5?

@Vistaus
Copy link

Vistaus commented Sep 22, 2024

Nope, kvantum-qt6 is installed and qt6ct and FeatherNotes do use the Kvantum theme I set, so it's partly functioning.

@ilya-fedin
Copy link

The only idea is maybe there's a miscommunication. Can you upload a screenshot of how it looks wrongly and (if possible) how it should look like?

@Vistaus
Copy link

Vistaus commented Sep 26, 2024

I have no idea what changed, but suddenly it's working now. Thanks for all of your help! 🙂

@Vistaus
Copy link

Vistaus commented Sep 26, 2024

Actually, scratch that: it works for a moment in for example Dolphin, but when I close Dolphin, it reverts to Breeze. Then I re-apply qt6ct as theme engine in System Settings and Dolphin looks fine again until I close it…

@ilya-fedin
Copy link

ilya-fedin commented Nov 9, 2024

I have set it to Kvantum.

I mean maybe you can provide a screenshot of qt6ct settings or the content of ~/.config/qt6ct/qt6ct.conf?

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

Sure, here you go:

[Appearance]
color_scheme_path=/usr/share/qt6ct/colors/darker.conf
custom_palette=false
icon_theme=Fluent-dark
standard_dialogs=kde
style=kvantum

[Fonts]
fixed="DejaVu Sans,16,-1,5,400,0,0,0,0,0,0,0,0,0,0,1,Book"
general="DejaVu Sans,16,-1,5,400,0,0,0,0,0,0,0,0,0,0,1,Book"

[Interface]
activate_item_on_single_click=0
buttonbox_layout=2
cursor_flash_time=0
dialog_buttons_have_icons=2
double_click_interval=400
gui_effects=@Invalid()
keyboard_scheme=3
menus_have_icons=true
show_shortcuts_in_context_menus=true
stylesheets=@Invalid()
toolbutton_style=2
underline_shortcut=1
wheel_scroll_lines=3

[SettingsWindow]
geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x5\x41\0\0\x2\x82\0\0\b\xd7\0\0\x6,\0\0\x5G\0\0\x2\xa0\0\0\b\xd1\0\0\x6&\0\0\0\0\0\0\0\0\xf\0\0\0\x5G\0\0\x2\xa0\0\0\b\xd1\0\0\x6&)"

[Troubleshooting]
force_raster_widgets=1
ignored_applications=@Invalid()

@ilya-fedin
Copy link

I have asked:

Did you set the color scheme with (KColorScheme) in the name?

You answered:

I did set that color scheme and I most definitely used qt6ct.

But this one

color_scheme_path=/usr/share/qt6ct/colors/darker.conf

Is not a KColorScheme.

@ilya-fedin
Copy link

Important thing is to choose a color scheme containing (KColorScheme) in name (such as Breeze Dark) as non-KDE color schemes (such as darker) won't KDE applications properly.

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

I know, but in the GUI of qt6ct it is set to Default and not the darker color scheme. So then it must be a bug in qt6ct.

@ilya-fedin
Copy link

ilya-fedin commented Nov 10, 2024

Right, your config also has

custom_palette=false

But my point is that it won't work with neither Default nor darker. You need a KColorScheme for KDE applications to look properly. In the Plasma session, you always have a KDE color scheme set (Breeze Light by default).

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

I have a KColorScheme set.

@ilya-fedin
Copy link

But the config says you don't. You have custom_palette=false and color_scheme_path=/usr/share/qt6ct/colors/darker.conf.

@ilya-fedin
Copy link

Maybe you configure qt5ct instead of qt6ct?

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

Then there still is a bug somewhere, either in qt6ct or in KDE's systemsettings.

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

Maybe you configure qt5ct instead of qt6ct?

Nope.

@ilya-fedin
Copy link

ilya-fedin commented Nov 10, 2024

Then there still is a bug somewhere, either in qt6ct or in KDE's systemsettings.

Hm. Can you provide a screenshot of your qt6ct settings (the first tab)?

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

Sure, here you go.

Schermafdruk_20241110_201708

@ilya-fedin
Copy link

ilya-fedin commented Nov 10, 2024

You don't have a KColorScheme set

The radio box has to be set to "Aangepast" and the drop down list to a value containing (KColorScheme) in name (and that provides a dark color scheme, of course).

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

But the color scheme from KDE systemsettings I have set is not available in that drop down list.

@ilya-fedin
Copy link

ilya-fedin commented Nov 10, 2024

Also, I just tried your qt6ct branch

But the color scheme from KDE systemsettings I have set is not available in that drop down list.

Are you sure you're using my branch? It's available only there.

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

Yes, I have manually compiled your branch qt6ct ‘shenenigans’.

@ilya-fedin
Copy link

ilya-fedin commented Nov 10, 2024

Yes, I have manually compiled your branch qt6ct ‘shenenigans’.

Are you sure you have no other qt6ct instance installed? Maybe you're launching that one instead of the compiled one.

@ilya-fedin
Copy link

On Arch you can just install qt6ct-kde package from AUR.

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

Nope, other one is not installed anymore. And qt6ct-kde from AUR also doesn't have the correct color scheme in the drop-down list.

@ilya-fedin
Copy link

And qt6ct-kde from AUR also doesn't have the correct color scheme in the drop-down list.

I wonder where the correct color scheme is located in the file system?

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

I just installed qt6ct-kde yet again and now it finally shows other color schemes in the dropdown list.

Schermafdruk_20241110_212103

However, Dolphin still looks the same. :(

@ilya-fedin
Copy link

Even if you launch it with QT_QPA_PLATFORMTHEME=qt6ct dolphin?

@Vistaus
Copy link

Vistaus commented Nov 10, 2024

No, then it looks right. I guess there's a bug in Arch somewhere then.

@ilya-fedin
Copy link

It might be not easy to override QT_QPA_PLATFORMTHEME in a Qt desktop environment such as LXQt...

@ilya-fedin
Copy link

If xdg-desktop-portal-lxqt supported org.freedesktop.appearance.color-scheme parameter, it would just work I guess, even without qt6ct...

@ilya-fedin
Copy link

If merged, this should restore the possibility to change color scheme via kdeglobals when there's no portal.
https://invent.kde.org/frameworks/kcolorscheme/-/merge_requests/28

@Vistaus
Copy link

Vistaus commented Nov 11, 2024

Great! Thanks for putting the time into that MR. 🙂

@ilya-fedin
Copy link

@Vistaus I was told you can specify your color scheme like

[UiSettings]
ColorScheme=Sonomatic

Usually it gets specified in app config file (e.g. dolpinrc) but it seem to also work with Dolphin when specified in kdeglobals from my testing.

On other hand, applications having color scheme chooser in UI (e.g. Elisa) seem to write ColorScheme setting with empty value to their config file if it isn't present what shadows the value in kdeglobals. But then you can easily select your color scheme in their UI.

@ilya-fedin
Copy link

If no answer, I would assume it works and will close the kcolorscheme MR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants