stylix icon indicating copy to clipboard operation
stylix copied to clipboard

kde: apply Qt theme on non-KDE systems

Open Jackaed opened this issue 9 months ago • 10 comments

Fixes plasma theme not applying on non-KDE desktop environments and on window managers. See #142.

Jackaed avatar May 15 '24 13:05 Jackaed

Here's Dolphin, fully themed under GNOME:

Screenshot of Dolphin

The missing file previews are because I didn't install the thumbnail service, nothing to do with this PR.

I didn't have much luck getting this to work with non-KDE Qt apps. Is it meant to theme those too?

danth avatar May 15 '24 17:05 danth

It worked with PCManFM-Qt when I tried it, so it works with some. What apps was it not working for?

Jackaed avatar May 15 '24 17:05 Jackaed

You're right, it works straight away with PCManFM. I just tried some XFCE apps and they work, too.

I was trying it with KeepassXC before, which does include its own theming menu, so it may just be that KeepassXC is doing its own thing even when I set it to use the system theme.

danth avatar May 15 '24 17:05 danth

If you set keepassxc to use the "Classic (platform native)" theme it should follow your system theme

Jackaed avatar May 15 '24 17:05 Jackaed

I tried that, but it kept a default white theme for some reason.

danth avatar May 15 '24 17:05 danth

Side note: This PR adds around 250 MiB downloaded and 800 MiB unpacked on a GNOME system, due to the dependency on plasma-workspace. Although it's not small, I think that's a reasonable price to pay for consistent theming across a number of different apps.

danth avatar May 15 '24 17:05 danth

I tried that, but it kept a default white theme for some reason.

Interesting - works fine on my machine. I think there'll always be some strange edge cases with how weird Qt theming is in general - probably best to deal with these cases as they come up.

Jackaed avatar May 15 '24 19:05 Jackaed

Side note: This PR adds around 250 MiB downloaded and 800 MiB unpacked on a GNOME system, due to the dependency on plasma-workspace. Although it's not small, I think that's a reasonable price to pay for consistent theming across a number of different apps.

We could try and remove the plasma-workspace dependency if it becomes a problem that people complain about by trying to write to kdeglobals directly, but I doubt it'll be an issue.

Jackaed avatar May 15 '24 20:05 Jackaed

In it's current iteration, this PR doesn't seem to work if home-manager.useUserPackages = true is set. Not sure why, will look into it when I have time.

Jackaed avatar May 16 '24 18:05 Jackaed

I've edited the PR to replace the dependency on plasma-workspace with just directly writing to kdeglobals instead.

Jackaed avatar May 16 '24 22:05 Jackaed

plasma-workspace taking 800 Mib. It should not be an issue but using kvantum (kvconfig) and qt5ct/qt6ct themes templates to generate and set them.

My Templates does contain a lot of pywal based templates but they are not in moustache format (they are in somthing similar). Rn m in mid of transition Arch->Nix porting them is not possible rn for me.

niksingh710 avatar Jun 30 '24 05:06 niksingh710

Dolphin (and I imagine other programs too) doesn't get correctly themed: image

dzervas avatar Jul 12 '24 13:07 dzervas

Dolphin (and I imagine other programs too) doesn't get correctly themed: Dolphin is being correctly themed on my system with my branch. Can you show me some more of your config?

Jackaed avatar Jul 12 '24 14:07 Jackaed

@Jackaed https://github.com/dzervas/dotfiles/tree/f2b784c3ef018b7693861140d8250bbbef3fdeb9 (ignore the flake lock that points to stylix, I did nix flake update --override-input stylix github:Jackaed/stylix locally)

only the nix folder is of interest - anything else isn't used for nixos the effective machine is laptop and the files of most interest should be system/display.nix, system/theme.nix and home/desktop/sway.nix

dzervas avatar Jul 12 '24 23:07 dzervas

The issue is that this did not previously have qt6 support, which it now does. You were using dolphin qt6 because you were using kdePackages.dolphin instead of just dolphin.

Jackaed avatar Jul 13 '24 10:07 Jackaed

Okay, after a lot of meddling, this now works with Qt6 everything (at least on my system, please test independently).

Jackaed avatar Jul 13 '24 16:07 Jackaed

Here is dolphin qt5 and qt6 both being themed correctly under my branch, side by side. Qt6 on the left, Qt5 on the right. image Same goes for okular: image

Jackaed avatar Jul 13 '24 16:07 Jackaed

OMG YES! image

EDIT: wow even the icons are magically fixed. did you do something about it?

dzervas avatar Jul 13 '24 22:07 dzervas

EDIT: wow even the icons are magically fixed. did you do something about it?

Yeah icons were a pain in the arse, installing kdePackages.full fixed them (note this doesn't install all of kde, just all of the qt6 dependency and extension libraries. Not sure what individual package fixed them, but glad it's working. Just need to try and get this merged now.

Jackaed avatar Jul 14 '24 00:07 Jackaed