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

kde: replace kdeglobals with Kvantum theme #142

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

Conversation

bluskript
Copy link

@bluskript bluskript commented Aug 6, 2023

The current KDE theming system is pretty unreliable (dolphin and many other programs ignore the theme and a lot of the time the apps that do theme are completely unreadable), I always found kvantum to give a lot more pleasant themes. So, I based this off of Catppuccin's kvantum theme and it turned out to work pretty well.

It isn't perfect, and there's some weirdnesses in some colorschemes sometimes, but that's kind of how all of base16 is.

Here's Dolphin, OpenRGB, and Strawberry open all themed correctly (Strawberry is QT6 so that works too!)
image
image
image
image

@bluskript
Copy link
Author

One thing to note, I needed to use qt5ct to manually set the icon theme, before this dolphin showed no icons and it was very bad. I'm not sure, what should the default behavior be? Should be have some kind of icon setting feature?

@danth
Copy link
Owner

danth commented Sep 10, 2023

dolphin and many other programs ignore the theme

This is unusual because when I tested the original implementation, Dolphin followed the Stylix theme without any issues. Even the folder icons were coloured to match the theme. But I agree, Kvantum is probably more reliable if we can make it work.

I needed to use qt5ct to manually set the icon theme, before this dolphin showed no icons and it was very bad

This is something which we will need to be handle automatically. As a start, would it be possible to have it always set the default icon theme?

@danth danth linked an issue Sep 10, 2023 that may be closed by this pull request
@danth danth changed the title add kvantum theming support Replace kdeglobals with Kvantum theme Sep 10, 2023
@Kasper24
Copy link
Contributor

Kasper24 commented Oct 4, 2023

2023-10-04_03-40

I think rather than changing the text color here, it would make more sense to use a darker color for active menu item.
Stylix gtk in comprassion:
image

modules/kvantum/hm.nix Outdated Show resolved Hide resolved
@sofiedotcafe
Copy link

+1

@bluskript
Copy link
Author

This is something which we will need to be handle automatically. As a start, would it be possible to have it always set the default icon theme?

@danth I addressed this issue with my latest commit, with these changes I think this should be ready.

modules/kvantum/hm.nix Outdated Show resolved Hide resolved
modules/kvantum/kvconfig.mustache Outdated Show resolved Hide resolved
@nonetrix
Copy link

nonetrix commented Dec 14, 2023

Isn't applying for me at all oddly, but it does setup Kvantum, QT theming is rather annoying on NixOS in general could be improved but it's beside the point, was hoping this makes it a lot easier at least on my end. Hoping this gets merged in and fixed, looking forward to it just working without much of a hassle
image

modules/kvantum/hm.nix Outdated Show resolved Hide resolved
@trueNAHO trueNAHO changed the title Replace kdeglobals with Kvantum theme kde: replace kdeglobals with Kvantum theme Feb 9, 2024
@danth danth mentioned this pull request Feb 10, 2024
@Suya1671
Copy link

I'm having some weird theming issues within Anki right now. Would this change fix this?
image

@ghost
Copy link

ghost commented Feb 25, 2024

+1

@musjj
Copy link
Contributor

musjj commented Mar 24, 2024

Are there any blockers here? Would love to see this merged.

@nonetrix
Copy link

I'm having some weird theming issues within Anki right now. Would this change fix this? image

Anki is always kinda weird with theming, somewhat need to theme it itself with extension that I forgot the name of. But mostly because of how a lot of the UI is just QTWebEngine which is pretty much Chromium. Not sure if this is related though

@danth
Copy link
Owner

danth commented May 15, 2024

@Jackaed That sounds great! If you have time, would you be able to put it together as a separate PR?

@Jackaed
Copy link
Contributor

Jackaed commented May 15, 2024

@danth Sure, I'll have a look and see what I can do. Reading through the code, there's a few things that I'm not sure I fully understand - not sure that github issues is the right place to discuss that, can we speak on matrix?

@danth
Copy link
Owner

danth commented May 15, 2024

Absolutely, feel free to use either the public chat #stylix:danth.me or message me directly @danth:danth.me

@donovanglover
Copy link
Contributor

Now that 24.05 is stable, we can change qt.platformTheme back to qt.platformTheme.name to remove the build warning.

modules/qt/hm.nix Outdated Show resolved Hide resolved
@MatthewCroughan
Copy link

What is blocking the merge of this generally?

@trueNAHO
Copy link
Collaborator

trueNAHO commented Nov 7, 2024

What is blocking the merge of this generally?

Is it possible to rebase this PR on top of master to simplify the manual testing process? I am encountering some errors when trying to replace my Stylix input from 04afcfc with e53d92d. However, this problem could just be a result of my setup.

@donovanglover
Copy link
Contributor

Feel free to try my fork or use curl https://github.com/donovanglover/stylix/commit/87612ee1cb96cc820abfdeba3724877141fcc4fa.patch | git am with your own repo

@trueNAHO
Copy link
Collaborator

trueNAHO commented Nov 7, 2024

Feel free to try my fork or use curl https://github.com/donovanglover/stylix/commit/87612ee1cb96cc820abfdeba3724877141fcc4fa.patch | git am with your own repo

This PR successfully builds on my setup after setting programs.kitty.enable = false;, as I require commit f95022b ("stylix: downgrade and lock tinted-kitty input (#589)"). However, I have not yet tested if the fork works as expected beyond building.

Unless the original author, @bluskript, is willing to take over this PR again, it might be better to supersede it with a new one that is properly rebased on top of danth/master.

Does @donovanglover's fork resolve the issue mentioned in #142 (comment)?

Please give proper credit in the squashed commit message of this rather old PR by giving Blusk <[email protected]> honorable commit authorship and crediting the following work at the end of the commit body:

Co-authored-by: Jackaed <[email protected]>
Reviewed-by: Daniel Thwaites <[email protected]>
Reviewed-by: NAHO <[email protected]>
Tested-by: NAHO <[email protected]>

It might be good to re-confirm Daniel (@danth) and NAHO's (@trueNAHO) credit tags before merging into danth/master.

Please send a comment if I missed any other up-to-date mention worthy contributions.


@donovanglover, do you want to take over this PR?

@donovanglover
Copy link
Contributor

I'm quite busy at the moment but anyone is free to continue working on this

@bluskript
Copy link
Author

bluskript commented Nov 9, 2024

Hi, I don't really use NixOS or Github much anymore so I can't really test the features, but I rebased this branch onto master, although it still needs someone to actually test if it still works. If further changes are needed someone else taking the PR would make sense I think.

The main blocker for this PR iirc is that in some places it actually causes theming regressions like in Anki but I haven't had the time to investigate why, and there was discussion that this could be done without kvantum, but again this is a lot of work to figure out. QT theming is just really confusing.

@MatthewCroughan
Copy link

I've been testing it a bit @bluskript, thanks for the rebase! qbittorrent-qt5 formerly worked fine with this PR, but now that Nixpkgs has dumped qbittorrent-qt5 in favour of qt6, it renders incorrectly with this PR as can be seen in the image. Qt5 applications like paraview look fine though.

image

@Jackaed
Copy link
Contributor

Jackaed commented Dec 27, 2024

@danth having done some more research into this, I'm in a bit of a bind. It seems like the Breeze theme reads it's color palette information directly from the kdeglobals file. This gives two options - either find some way to mutate kdeglobals without causing problems (this is essentially incompatible with Nix - you would need to be able to mutate certain parts of the file through Nix code while leaving the rest entirely unchanged), or use either qt5ct/qt6ct or Kvantum. Kvantum looks worse than Breeze IMO, and qt5ct/qt6ct seems to have some issues as well. Either way, it's really, really not ideal, and I have no clue why the KDE people did it this way.

@timonteutelink
Copy link

@danth Any blockers on this?

@Mikilio
Copy link
Contributor

Mikilio commented Jan 13, 2025

I am a bit late to the discussion, but I really want this PR to complete, so I'd like to help in any way possible.
Firstly, I don't use KDE, so I am clearly biased towards just merging Kvantum theming. I do understand that KDE user prefer a solution that relies on the kdeglobals. As @Jackaed has pointed out, this requires somehow to mutate only parts of the file. The usual approach for this is to generate the entire file with nix and use an overlayfs similar to environment.etc in NixOS or some files in home-manager. Either way, this should wait until both NixOS and home-manager make a module for this.

What I would like to push for here is that Kvantum is necessary for anyone using Qt apps without KDE. So it should be enabled for everyone that is not using KDE. The handling for kdeglobals could and should be improved in a separate PR, and this PR should finally give non KDE users what they need without stepping on anyone's feet.

@danth @trueNAHO If this approach is acceptable, I will proceed to review and edit this PR.

@Jackaed
Copy link
Contributor

Jackaed commented Jan 13, 2025

I am a bit late to the discussion, but I really want this PR to complete, so I'd like to help in any way possible.
Firstly, I don't use KDE, so I am clearly biased towards just merging Kvantum theming. I do understand that KDE user prefer a solution that relies on the kdeglobals. As @Jackaed has pointed out, this requires somehow to mutate only parts of the file. The usual approach for this is to generate the entire file with nix and use an overlayfs similar to environment.etc in NixOS or some files in home-manager. Either way, this should wait until both NixOS and home-manager make a module for this.

What I would like to push for here is that Kvantum is necessary for anyone using Qt apps without KDE. So it should be enabled for everyone that is not using KDE. The handling for kdeglobals could and should be improved in a separate PR, and this PR should finally give non KDE users what they need without stepping on anyone's feet.

@danth @trueNAHO If this approach is acceptable, I will proceed to review and edit this PR.

Tbh the main issue I have with this PR is that I don't think Kvantum looks as good as Breeze. But I think that merging this would be absolutely fine especially if we kept the two different theming mechanisms behind a configurable setting.

Also, does the current state of the module work for KDE users as-is? My understanding is that it does, since it can use plasma-apply-lookandfeel or whatever the command is. So maybe merging this as an option for non KDE users fixes all of our problems entirely.

I'm fairly close to giving up on making Breeze properly themable without using KDE. You end up having to install half the desktop environment to get it and I'm left with a bunch of crap I didn't want, like the KDE settings menu.

TL;DR this is a good idea.

@nonetrix
Copy link

nonetrix commented Jan 13, 2025

I am a bit late to the discussion, but I really want this PR to complete, so I'd like to help in any way possible. Firstly, I don't use KDE, so I am clearly biased towards just merging Kvantum theming. I do understand that KDE user prefer a solution that relies on the kdeglobals. As @Jackaed has pointed out, this requires somehow to mutate only parts of the file. The usual approach for this is to generate the entire file with nix and use an overlayfs similar to environment.etc in NixOS or some files in home-manager. Either way, this should wait until both NixOS and home-manager make a module for this.

What I would like to push for here is that Kvantum is necessary for anyone using Qt apps without KDE. So it should be enabled for everyone that is not using KDE. The handling for kdeglobals could and should be improved in a separate PR, and this PR should finally give non KDE users what they need without stepping on anyone's feet.

@danth @trueNAHO If this approach is acceptable, I will proceed to review and edit this PR.

You can just set QT_QPA_PLATFORMTHEME=kde and install a few KDE things, that has worked for me at least on Arch but haven't tried Nix. Afterwards you can use plasma-apply-colorscheme and there's a whole bunch of commands similar to that you can find with tab complete, for some reason the command to change icons was hidden under /usr/lib/plasma-changeicons though. It might cause issues? But I've actually had less sense using this instead of Kvantum personally, all I want is a color scheme so it works out fine for me. As mentioned above you do have to install plasma-workspace on Arch and I'm not sure what NixOS equivalent would be, but on Arch that appears to not include much really doesn't add selectable KDE session or KDE apps I can see or anything so eh whatever

@Mikilio
Copy link
Contributor

Mikilio commented Jan 14, 2025

I intend to only enable Kvatum if none of the following are enabled:

  • KDE
  • GNOME
  • LXQt

Which means I want to make this PR into something that is obsolete for anyone using the above.
Just give me a thumbs up if you agree.

@trueNAHO
Copy link
Collaborator

Tbh the main issue I have with this PR is that I don't think Kvantum looks as good as Breeze. But I think that merging this would be absolutely fine especially if we kept the two different theming mechanisms behind a configurable setting.

Currently, Stylix leverages several themes. Ideally, in the future, all popular themes would be supported and could be globally selected with something like stylix.theme = "Kvantum"; or stylix.theme.kvantum = true;. However, it might be better to re-consider this once the following task has been resolved:

  • (4) Support base24 scheme 7 and Vim highlight groups 5 to resolve styling inconsistencies

-- NAHO, "Roadmap"

What I would like to push for here is that Kvantum is necessary for anyone using Qt apps without KDE. So it should be enabled for everyone that is not using KDE. The handling for kdeglobals could and should be improved in a separate PR, and this PR should finally give non KDE users what they need without stepping on anyone's feet.

Sorry for having lost track of the plan. Is the plan to add standalone support for the Kvantum theme?

@trueNAHO If this approach is acceptable, I will proceed to review and edit this PR.

In that case, this approach sounds good to me.

I intend to only enable Kvatum if none of the following are enabled:

  • KDE
  • GNOME
  • LXQt

Which means I want to make this PR into something that is obsolete for anyone using the above. Just give me a thumbs up if you agree.

Considering the blockers of this PR, it seems good to guard against these known these problems.

@ppenguin
Copy link

Just as another datapoint (test result): I've had the configuration that is set by the module in this PR configured for a long time, but it never actually worked. In my case I have set stylix (and the corresponding base16 scheme) to OutrunDark, which is a pretty obvious dark theme. As an example, kvantummanager is correctly themed, but e.g. filelight never has been.

However, when I do the following (and only then), filelight is also correctly themed:

> nix-shell -p kdePackages.plasma-workspace
fetching path input 'path:/nix/store/7hw19rbs6p20l2gxbf13la04pcs2znmz-source'
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring

[nix-shell:~]$ plasma-apply-colorscheme OutrunDark
Successfully applied the color scheme OutrunDark to your current Plasma session

[nix-shell:~]$ filelight 
qrc:/ui/OverviewPage.qml:11:1: QML OverviewPage: Created graphical object was not placed in the graphics scene.
The cached device pixel ratio value was stale on window update.  Please file a QTBUG which explains how to reproduce.

Interestingly, if I choose plasma-apply-colorscheme Kvantum the background colours of apps are incorrect (grey instead of dark blue), even though in kvantummanager the shown theme is in fact OutrunDark, which is if I understand correctly actually defined trough stylix.base16scheme = "${pkgs.base16-schemes}/share/themes/outrun-dark.yaml"; and then via this PR's kvconfig logic.

So it seems the HM config logic is still missing one step, i.e. the one that is applied by plasma-apply-colorscheme, though I have no idea what it actually does and where this information is held? And whether it relies on (mandatory?) deps pulled in by plasma-workspace (It appears though that after using plasma-apply-colorscheme once, it also works outside of the nix-shell, so the latter seems to be a negative.)

@Mikilio
Copy link
Contributor

Mikilio commented Jan 23, 2025

For anyone interested in kvantum theming, check out my PR #780. Note the requirements for it to have an effect (it might still work anyway, but I only give guarantees if these are met).
For DE specific Qt theming, please open an issue.
Unfortunately, I really lack the motivation to implement changes that have no effect on my setup.

@ppenguin
Copy link

For anyone interested in kvantum theming, check out my PR #780. Note the [requirements]

Hey thanks, that seems to polish this PR to be useful ootb.

(#142 (comment)) for it to have an effect (it might still work anyway, but I only give guarantees if these are met). For DE specific Qt theming, please open an issue. Unfortunately, I really lack the motivation to implement changes that have no effect on my setup.

The point I tried to make above is that I do seem to satisfy the requirements, but the colour scheme has never correctly worked for Qt6 apps until I manually executed plasma-apply-colorscheme once. The icon theme in e.g. the file browser of filelight is still not applied, even though my config does pretty much everything this PR's module does. So I would be interested in understanding what it does so we might be able to force the same outcome with stylix/HM.

I'll try applying #780 when I find some time and see whether anything changes. (Tough I'd still need to know where the changes applied by plasma-apply-colorscheme are actually stored?)

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.

kde: theme is partially applied