danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
1.11k stars 139 forks source link

kde: `.gtkrc-2.0` is overwritten by GNOME/GTK Settings Synchronization Service #267

Open mrnetlex opened 7 months ago

mrnetlex commented 7 months ago

At every reboot something (I would suspect kde-gtk-config) overwrites .gtkrc-2.0 and my cursor, fonts revert to those set in system settings. I can improve situation by removing .gtkrc-2.0 and running nixos-rebuild switch, but then cursor theme apply only to GTK programs, but not any QT programs and plasma elements like.

QT and GTK color themes work perfectly fine.

My configuration:

{
  #Stylix
  stylix.image = /home/netlex/NixOS/wallpapers/Tokyonight/cafe-at-night_00_3840x2160.png; 
  stylix.polarity = "dark"; 
  stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/tokyodark-terminal.yaml"; 
  stylix.cursor = {
    package = pkgs.qogir-icon-theme;
    name = "Qogir";
  };
  stylix.fonts = {
    serif = {
      package = pkgs.nerdfonts;
      name = "FireCode Nerd Font";
    };

    sansSerif = {
      package = pkgs.nerdfonts;
      name = "Ubuntu Nerd Font";
    };

    monospace = {
      package = pkgs.nerdfonts;
      name = "JetBrainsMono Nerd Font";
    };

    emoji = {
      package = pkgs.noto-fonts-emoji;
      name = "Noto Color Emoji";
    };
  };

  stylix = {
      opacity = let
        opacity_value = 0.8;
      in
        {
          applications = opacity_value;
          desktop = opacity_value;
          popups = opacity_value;
          terminal = opacity_value;
        };
    };

}
trueNAHO commented 7 months ago

As a side note,

stylix.image = /home/netlex/NixOS/wallpapers/Tokyonight/cafe-at-night_00_3840x2160.png;

might be considered as impure by Flakes.

mrnetlex commented 7 months ago

Don't really care about it, because it's just wallpaper, but I probably should change it to relative path. It would be enough to fix it?

LovingMelody commented 6 months ago

Relative paths are still impure, wallpaper just needs to be git tracked or fetched from an online source

Kitt3120 commented 4 months ago

Similar problem here. I installed stylix into my NixOS configuration using the non-flake variant. I fetch the package from GitHub and import the re-exported nixosModules.stylix. Except this issue, everything works.

Every time I do a nixos-rebuild switch, and stylix applies its targets because something like my wallpaper changed, it works only once. After that, the .gtkrc-2.0 file in my home exists. Because of this, the home manager service for my user can't come back up, cause it tries to also write into that file, but the existing file is in its way.

For example, this does not just happen after a reboot, but also when changing wallpaper and applying my config again with nixos-rebuild switch. If I don't manually delete the .gtkrc-2.0 in my home folder manually, the home manager service fails because .gtkrc-2.0 is already there. This still happens even when setting stylix.targets.gtk.enable = false, so maybe something with the KDE Plasma module? Or maybe the files are being generated by Plasma itself.

Edit:

I just saw that this issue has been addressed for KDE Plasma 5. The fix probably does not work anymore for Plasma 6. I guess the kded5rc file has been renamed to kde6rc? I'll try to come up with a patch.

Edit2:

Found a solution for this

Okay while writing the patch, I noticed that this doesn't work. I thought that I could just copy over the solution for kded5rc as kded6rc, but Plasma 6 changed how this works. It actually doesn't use a kded6rc file anymore. Instead, there is now a GNOME/GTK theme sync background service running with Plasma 6.

It can be disabled by going into System Settings -> Session (very bottom category) -> Background Services -> GNOME/GTK Settings Synchronization Service. With it disabled, stylix works fine now. Maybe someone finds a solution to disabled this through the stylix KDE module? If not, this should at least be mentioned somewhere in the docs or in the README.

danth commented 4 months ago

Instead, there is now a GNOME/GTK theme sync background service running with Plasma 6.

This is the same as with Plasma 5; that's what the kded5rc setting is turning off. I can confirm that it worked in Plasma 5, at least after manually removing the file the first time (since the service isn't disabled until after applying Stylix).

The KDE module hasn't been updated at all for Plasma 6 yet.

Kitt3120 commented 4 months ago

Instead, there is now a GNOME/GTK theme sync background service running with Plasma 6.

This is the same as with Plasma 5; that's what the kded5rc setting is turning off. I can confirm that it worked in Plasma 5, at least after manually removing the file the first time (since the service isn't disabled until after applying Stylix).

The KDE module hasn't been updated at all for Plasma 6 yet.

Ohh alright. I forked the project and imported Stylix from my local checkout, but I just couldn't get it to generate the kded6rc file. Maybe I was doing something wrong. I then created it manually, but it still didn't work, probably because the service was still running. That's how I came to my conclusion.

I also noticed that the testbed file does not have the updated attributes yet.

Do you want me to make a PR tomorrow with my current state and you can take it from there?

danth commented 4 months ago

I don't have much time to work on this myself right now, but feel free to open one anyways.

I also noticed that the testbed file does not have the updated attributes yet.

If you post this as a separate PR, that part should be OK to merge straight away.

mogery commented 4 months ago

It can be disabled by going into System Settings -> Session (very bottom category) -> Background Services -> GNOME/GTK Settings Synchronization Service. With it disabled, stylix works fine now. Maybe someone finds a solution to disabled this through the stylix KDE module? If not, this should at least be mentioned somewhere in the docs or in the README.

I think you can disable this via plasma-manager. I'll update this comment when trying it at home today.

Kitt3120 commented 4 months ago

Made a PR for this, turns out testbeds work way different than I thought. The PR can't be merged this way, but I made some suggestions in that PR, so I would appreciate checking it out.

hasrthur commented 1 month ago

It can be disabled by going into System Settings -> Session (very bottom category) -> Background Services -> GNOME/GTK Settings Synchronization Service. With it disabled, stylix works fine now. Maybe someone finds a solution to disabled this through the stylix KDE module? If not, this should at least be mentioned somewhere in the docs or in the README.

I think you can disable this via plasma-manager. I'll update this comment when trying it at home today.

@mogery hi! have you managed to disable that with plasma manager?

hasrthur commented 1 month ago

It can be disabled by going into System Settings -> Session (very bottom category) -> Background Services -> GNOME/GTK Settings Synchronization Service. With it disabled, stylix works fine now. Maybe someone finds a solution to disabled this through the stylix KDE module? If not, this should at least be mentioned somewhere in the docs or in the README.

I think you can disable this via plasma-manager. I'll update this comment when trying it at home today.

@mogery hi! have you managed to disable that with plasma manager?

I came up with such a solution:

programs.plasma.configFile.kded5rc = {
   "Module-gtkconfig"."autoload" = false;
};