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

Add KDE theming support #43

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

ilya-fedin
Copy link

@ilya-fedin ilya-fedin commented Mar 11, 2024

KDE applications are a notable part of the popular Qt software in the Linux world.
Sadly, they have their own theming add-ons that are applied through QPlatformTheme.

This adds support for all aspects of the KDE applications theming present in the plasma-integration QPlatformTheme:

  • KDE's QtQuick style bridging the currently set QtWidgets style (you may want to get QtQuick style choice in the settings UI in the future instead)
  • KDE's color schemes (the most important part as KDE applications don't fallback to QtQuick style/QtWidgets style/QPalette for colors)
  • KDE's icon engine applying KDE's color schemes to icons (to not to have dark icons on dark background)
  • Writing widget style and icon theme to kdeglobals for applications using KStyleManager

I also have a qt5ct variant of this patch but I don't have a SourceForge account nor SVN experience to send it there... If you wish I can upload the patch here as a file.

Fixes #38

@ilya-fedin ilya-fedin force-pushed the kde branch 2 times, most recently from aebba29 to afe600a Compare March 12, 2024 00:07
@spikespaz
Copy link

spikespaz commented Mar 28, 2024

Do you know the name of the Qt module that provides QQuickStyle? I thought it was qtdeclarative but maybe not. It's failing to find that include. Trying to build with Nix.

@ilya-fedin
Copy link
Author

ilya-fedin commented Mar 28, 2024

@spikespaz I have a package (and a module) for nix in https://github.com/ilya-fedin/nur-repository. Regarding the Qt module, yeah, it's qtdeclarative.

@mechakotik
Copy link

Tried it out, most KDE apps work fine for me, but Plasma system monitor doesn't follow the color scheme correctly and looks like this:
image
Here are the logs:

kf.config.core: Watching absolute paths is not supported "/home/mecha/.local/share/color-schemes/BreezeDarkTeal.colors"
kf.kirigami.platform: Failed to find a Kirigami platform plugin for style "Fusion"
qrc:/qt/qml/org/kde/ksysguard/page/EditablePage.qml?page=history.page:223:9: QML Loader: Binding loop detected for property "height"
file:///usr/lib/qt6/qml/org/kde/kirigami/Dialog.qml:334:18: QML ScrollView: Binding loop detected for property "calculatedImplicitWidth"
file:///usr/lib/qt6/qml/org/kde/kirigami/Dialog.qml:386:33: QML Binding: Binding loop detected for property "target"
qml: Implementation matching https://systemd.io/DESKTOP_ENVIRONMENTS/ was not found. ApplicationsView will not be available

KDE system settings app has the same problem.

@ilya-fedin
Copy link
Author

Should be ok now

@Hasshu
Copy link

Hasshu commented Jun 18, 2024

@trialuser02 Is there anything blocking this PR?

@spion
Copy link

spion commented Jul 6, 2024

FWIW I tried this patch and it seems to affect the "dark mode" setting on my system in browsers like Chromium (that is, dark KDE themes don't seem to make chromium think the system is set into "dark mode", but color schemes do)

Its also probably a good idea to disable copying the KDE themes as the created copies don't work

@ilya-fedin
Copy link
Author

Its also probably a good idea to disable copying the KDE themes as the created copies don't work

What copying are you talking about?

@spion
Copy link

spion commented Jul 7, 2024

What copying are you talking about?

Next to the color scheme dropdown, there is an actions dropdown menu with a "Create a copy" item. I wanted to use it to try and tweak the KDE scheme and see if I can get it to trigger "dark mode". This created a copy of the file under ~/.config/qt6ct/colors that doesn't work when selected.

@ilya-fedin
Copy link
Author

Next to the color scheme dropdown, there is an actions dropdown menu with a "Create a copy" item.

Should be hidden now

@ilya-fedin ilya-fedin force-pushed the kde branch 6 times, most recently from 405b938 to aef8f90 Compare July 7, 2024 05:18
@ilya-fedin
Copy link
Author

I wonder whether we want to handle that new thing of KDE frameworks reading kdeglobals directly instead of following Qt settings (icon theme/widget style)?

That would mean modifying kdeglobals thus changing the settings of Plasma session (if one has it)...

@ilya-fedin ilya-fedin force-pushed the kde branch 2 times, most recently from 91d3e81 to 89a2bd4 Compare October 2, 2024 03:05
@ilya-fedin
Copy link
Author

ilya-fedin commented Oct 2, 2024

I wonder whether we want to handle that new thing of KDE frameworks reading kdeglobals directly instead of following Qt settings (icon theme/widget style)?

Implemented it. Also made PRs with some changes that should make qt6ct behave way less buggy:
#52
#53
#54
#55

But it seems there are low changes of them being merged given maintainer's inactivity...

@Prepodobnuy
Copy link

@ilya-fedin pls update the aur package <3

@ilya-fedin
Copy link
Author

It has the latest version of the patch...

@ilya-fedin
Copy link
Author

@Prepodobnuy you may need to rebuild the package with the new Qt version

@Hasshu
Copy link

Hasshu commented Oct 17, 2024

@Conan-Kudo @grulja Do you think we could have this in Fedora?

@ilya-fedin ilya-fedin force-pushed the kde branch 6 times, most recently from 5fdf5b9 to ff3e831 Compare October 20, 2024 23:03
@ilya-fedin
Copy link
Author

ilya-fedin commented Oct 20, 2024

I've splitted theming bits to separate commits. They are also now optional so qmake build works (but builds without any KDE theming bits of course).

idk whether anyone needs it but I splitted the commits refactoring Qt6CT::{resolvePath,loadColorScheme} to a separate PR (#58) and while working on optionalisation, I also made cmake build to support building without QtWidgets (#57).

@ilya-fedin ilya-fedin force-pushed the kde branch 2 times, most recently from 8a93007 to de710a2 Compare October 21, 2024 02:31
@ilya-fedin
Copy link
Author

If anyone needs all commits from all PRs rebased on top of each other, based on 0.9, as in my packages, here they are: https://github.com/ilya-fedin/qt6ct/tree/shenanigans

This allows to style applications that use KStyleManager
@ilya-fedin ilya-fedin force-pushed the kde branch 2 times, most recently from 0ed4895 to 280b5f5 Compare October 21, 2024 04:30
It has KDE color schemes support that prevents dark icons on dark background
@ilya-fedin
Copy link
Author

With KF 6.8, applications using KColorSchemeManager should start to follow palette changes in runtime just like applications not using it

@ilya-fedin
Copy link
Author

ilya-fedin commented Nov 15, 2024

FWIW, I also tried (unsuccessfully) to communicate the kvantum dev that he does things that make the palette stuck even after switching out of Kvantum to other style in runtime, both with vanilla's qt6ct AA_SetPalette check and my QWindowSystemInterface::handleThemeChange approach (as it basically checks AA_SetPalette under the hood, too). The discussion is at tsujan/Kvantum#1018

@Gigas002
Copy link

Sorry, I don't know if it's related to KDE support in qt6ct, but dolphin misses theming of icons, when you target the search path, e.g. here the above icon is not themed, while all the others are themed correctly.

image

This works fine when running on KDE, only affects other compositors.

@ilya-fedin
Copy link
Author

Perhaps your icon theme just has no such icon so it falls back to Breeze?

@Gigas002
Copy link

Hmm, I think you may be right. I've tested some other themes and all of these are themed correctly.
I thought this behavior is weird, since this works correct on KDE session, but I guess I should take a look at the theme itself. Sorry for the noise.

@ilya-fedin
Copy link
Author

Maybe it just looks similar but still from some other icon theme on KDE session?

@Gigas002
Copy link

I found the missing icon, it was the folder-open.svg. Placed it under /usr/share/icons/theme_name/Places/folder-open.svg and it resolved the issue.

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 this pull request may close these issues.

Configured theme not applying to all applications
7 participants