stylix icon indicating copy to clipboard operation
stylix copied to clipboard

kde: replace `kdeglobals` with `Kvantum` theme

Open bluskript opened this issue 1 year ago • 33 comments

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 avatar Aug 06 '23 00:08 bluskript

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?

bluskript avatar Aug 06 '23 00:08 bluskript

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 avatar Sep 10 '23 19:09 danth

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

Kasper24 avatar Oct 04 '23 00:10 Kasper24

+1

jh-devv avatar Oct 22 '23 17:10 jh-devv

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.

bluskript avatar Oct 22 '23 23:10 bluskript

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

nonetrix avatar Dec 14 '23 22:12 nonetrix

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

Suyashtnt avatar Feb 14 '24 18:02 Suyashtnt

+1

ghost avatar Feb 25 '24 23:02 ghost

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

musjj avatar Mar 24 '24 17:03 musjj

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

nonetrix avatar Mar 24 '24 18:03 nonetrix

Been using this branch for a few months now, thanks :+1:

Can you rebase? Would prevent having to overlay base16-schemes

donovanglover avatar Apr 01 '24 09:04 donovanglover

Hi, are you able to rebase this on commit b36fb34a9c8fb728c7efe5dbbb222bb23dcaa967 or later such that I can run it through a testbed?

That would be much appreciated.

danth avatar Apr 22 '24 13:04 danth

These changes don't seem to allow for a way of configuring your icon theme within qt. Could this be added?

Jackaed avatar Apr 23 '24 15:04 Jackaed

I created a PR on bluskript's fork implementing a change that allows you to choose a qt icon theme name: https://github.com/bluskript/stylix/pull/1

Jackaed avatar Apr 23 '24 16:04 Jackaed

Oh this is my fault, qt.platformTheme has been renamed to qt.platformTheme.name on unstable but I imagine that hasn't happened on stable yet. If you change it back, you get a warning on unstable but it still works.

Jackaed avatar Apr 26 '24 08:04 Jackaed

@bluskript I've made a PR for a fix for this on your repo, please merge it and this should fix the build failure

Jackaed avatar Apr 26 '24 15:04 Jackaed

I rebased on release-23.11 for my tests, and it seems to work pretty well for the majority of apps, as far as I can tell with a quick check. Until now, I found two quirks:

  • Okular appears to have an independent color scheme setting. One needs to manually select Settings→Color Scheme→Kvantum. Perhaps something can be done so that the Default setting would be equivalent?
  • Gwenview doesn't work, see the screenshot below. The menu contains some entries for changing the theme under Menu→More→View, but they are disabled.

image

exzombie avatar May 03 '24 09:05 exzombie

The previous implementation based on kdeglobals also themed desktop elements on KDE such as window decorations and panels (when it was working correctly). This does not appear to be possible using Kvantum.

danth avatar May 03 '24 09:05 danth

You're right. The machine where I applied the HM+stylix configuration was pretty fresh, no stylix nor any other previous configuration. Now, I tried applying the same configuration to another machine which was previously manually configured, and both Gwenview and Okular worked as they are supposed to. There was a residual kdeglobals file there, not present in the first machine. After removing the kdeglobals file, Okular and Gwenview looked broken the same way as on the first machine.

So, it looks like this PR will need to include kdeglobals to at least configure the colors, even if the majority of work is delegated to Kvantum.

exzombie avatar May 03 '24 10:05 exzombie

The issue with the original implementation may also be caused by a similar problem.

Using the testbed VM, the original implementation always themes KDE fully, once you have restarted Home Manager due to the fact that it can only apply the configuration while KDE is running.

Perhaps we should put more work into improving the way kdeglobals is managed before resorting to Kvantum?

KDE has a high number of settings across different files, any of which could be causing kdeglobals not to apply correctly on a system with existing state.

danth avatar May 03 '24 11:05 danth

Perhaps we should put more work into improving the way kdeglobals is managed before resorting to Kvantum?

Isn't kdeglobals a different problem from the Kvantum module?

The theming of Qt applications should be DE agnostic, just like the Gtk module. Different desktop environments could then use their own Qt implementation by overwriting the QT_QPA_PLATFORMTHEME variable. For example: plasma-integrations for KDE, qgnomeplatform, for Gnome and qtct for WMs/Compositors.

This would unblock the situation regarding this PR and shift the responsibility for integration to the desktop environment in their respective modules.

e-tho avatar May 08 '24 12:05 e-tho

Isn't kdeglobals a different problem from the Kvantum module?

Correct. I just noticed that, contrary to the title of the PR, the original KDE module is no longer removed. This was originally the case given 20b08d36fcb0fdd6f44a90ddd060a846a20ad27c, but at some point it must have been restored.

Different desktop environments could then use their own Qt implementation by overwriting the QT_QPA_PLATFORMTHEME variable.

Absolutely. See #203 regarding this.

danth avatar May 10 '24 14:05 danth

The following screenshots were taken after restarting a few services to get kdeglobals to apply fully. The need to restart is not relevant to whether we merge this PR, since it occurs on the master branch too.

Original appearance:

image

Appearance with this PR:

image

The only major blocker now is that the icons are dark on a dark background, which makes them very difficult to see.

The Kvantum theme does look worse than Breeze IMHO, however since kdeglobals is still configured we can presumably still access Breeze when using KDE by disabling this new target. In the future, we can add a proper option to switch between Breeze/Adwaita/other designs (see the issue linked in my previous comment).

Looking forward to getting this merged so we can have proper Qt support across all desktop environments :)

danth avatar May 10 '24 14:05 danth

Since you can configure qtct to use Breeze, is there not a way to configure a Breeze theme without using kdeglobals? That way we can just use breeze and get consistent aesthetics across different desktops, rather than having to "settle" for Kvantum on WMs.

I also think it might be worth re-evaluating how icons are handled in general - would a global icon theme setting be a good idea/worth pursuing?

Jackaed avatar May 11 '24 16:05 Jackaed

🤔 Maybe we can look at how the HM module, Plasma-Manager handles applying themes (icons, lookAndFeel, etc.) for KDE Plasma? This module in particular seems to do a good job in applying themes for Plasma 6 (which stylix currently has trouble applying, related to #350)

NovaViper avatar May 11 '24 18:05 NovaViper

Okay so I've done some more testing, it is possible to get it working with kdeglobals if you install libsForQt5.plasma-workspace, set style to Breeze and set your theme to default, and run plasma-apply-lookandfeel --apply stylix. Proof of this working on Hyprland:

image

This is a bit of a hack and I don't think it's how we should choose to do things - instead, I think the best way would be to use qt5ct's "custom" color settings as a target, which means we don't depend on Kvantum. I also imagine the settings for theming through qt5ct are similar to doing it through kdeglobals. It would also allow us to theme qt6 consistently through qt6ct.

Jackaed avatar May 11 '24 18:05 Jackaed

Okay more testing with qt5ct makes me realize that certain applications seem to get their colors from the global theme regardless of your choice of colors for qt5ct. It might be that my hacky way of doing things isn't as bad as I initially thought.

Jackaed avatar May 11 '24 21:05 Jackaed

This is such a mess. Firstly, I can only get plasma-apply-lookandfeel --apply stylix to work if my current directory is .nix-profile. Won't even allow an objective path.

If I try and get it working without qt5ct, I get something like this when using the command QT_QPA_PLATFORMTHEME=kde QT_STYLE_OVERRIDE=Breeze dolphin:

image

I can get it to work with qt5ct, and get the screenshot in my above post, but I'm not configuring my colors through qt5ct in that instance, I'm just telling it to use the system defaults, but it seems to just work.

Make it make sense, I'm losing my mind over this.

The other weird thing is that for whatever reason, the moment you use qt5ct, the bottom right storage space indicator becomes incredibly ugly (again see screenshot in above post) and I have no clue why that is. Hopefully there's some environment variable that I'm missing or something because this is driving me insane.

Edit:

So my best guess at the moment is that all qtct does when you set colour scheme to default is convert whatever is in kdeglobals into its own theming system and works from there. The reason for the questionable dolphin theming then comes from dolphin also independently reading kdeglobals when setting the background colour for the window.

I think the best bet is to use qtct and write directly to kdeglobals for the theme. The only inconsistency this causes is the weird drive usage thing not looking like it should on Breeze, as well as Breeze icons not being able to theme themselves according to the system theme. I'll see if there's anything you can do about it within qtct.

Jackaed avatar May 11 '24 21:05 Jackaed

OKAY so I've finally gotten it working in the same way that it works on KDE on a non-kde system. The thing I was missing is that in order for QT_QPA_PLATFORMTHEME=kde to work, you need to have libsForQt5.plasma-integrations installed.

Home-manager will install this for you if you set qt.platformTheme="kde", but also installed libsForQt5.systemsettings which I think is undesirable for most people not on KDE.

When you do so, the theming information is then read in from kdeglobals. Therefore, in order to get stylix working as intended on other systems, we just need to write what we've been writing to .nix-profile/share/color-schemes/<theme-name>.colors to .config/kdeglobals and everything seems to work more or less as intended.

You obviously also need to set QT_STYLE_OVERRIDE=Breeze and have Breeze installed for this to work, but then you get pretty much identical functionality to what you get on KDE, including proper coloring of icons.

Apologies if none of this is new information but I've gone down the rabbit hole at this point, so I figured I may as well write it up.

Jackaed avatar May 12 '24 18:05 Jackaed

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

danth avatar May 15 '24 07:05 danth