NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.3k stars 13.54k forks source link

Graphite Theme does not apply in XFCE environment #276349

Closed D3vil0p3r closed 8 months ago

D3vil0p3r commented 8 months ago

Describe the bug

I'm using flakes to deploy a configuration in NixOS consisting of XFCE as desktop environment and Graphite as theme.

The configuration can be found in https://github.com/Athena-OS/athena-nix

and the configuration can be deployed by:

sudo nixos-rebuild switch --flake 'github:Athena-OS/athena-nix#xfce'

The xfce configuration should install also Graphite Theme as specified here but after the deployment, Graphite Theme is not applied.

Steps To Reproduce

Steps to reproduce the behavior:

  1. In NixOS, run sudo nixos-rebuild switch --flake 'github:Athena-OS/athena-nix#xfce'
  2. Check on a GTK window if the theme is changed

Expected behavior

Theme applied correctly.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

@romildo

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.68, NixOS, 24.05 (Uakari), 24.05.20231219.54aac08`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

Aleksanaa commented 8 months ago

You should use gtk.theme.package. Also this is related to how home-manager works, which is less relevant here.

D3vil0p3r commented 8 months ago

You should use gtk.theme.package. Also this is related to how home-manager works, which is less relevant here.

Is there a way to set GTK themes with no home-manager?

Aleksanaa commented 8 months ago

Is there a way to set GTK themes with no home-manager?

A forced but not recommended method is to use GTK_THEME. You can also try adding in /etc/gtk-3.0/settings.ini:

[Settings]
gtk-theme-name = <Your theme>

But I'm not sure if that works.

D3vil0p3r commented 8 months ago

Thank you @Aleksanaa . What I'm noting is is that, since I'm using Thunar (XFCE default one) as File Manager, when I configure GTK Graphite theme as:

{ pkgs, nixpkgs, home-manager, username, ... }:
{

  home-manager.users.${username} = { pkgs, ...}: {
    home.packages = with pkgs; [
      bibata-cursors
    ];
    gtk = {
      enable = true;
      gtk3.extraConfig.gtk-decoration-layout = "menu:";
      cursorTheme.name = "Bibata-Modern-Ice";
      iconTheme.package = pkgs.tela-circle-icon-theme.override {
        colorVariants = [ "black" ];
      };
      iconTheme.name = "Tela-circle-dark";
      theme.package = pkgs.graphite-gtk-theme.override {
        tweaks = [ "rimless" ];
      };
      theme.name = "Graphite-Dark";
    };
  };
}

Thunar window appears like: image

While, if I use Nautilus (GNOME default File Manager) in my NixOS, it correctly is shown as: image

Thunar Graphite theme should appear like the following one I have in my Arch Linux VM: image

Why Thunar seems to not apply the Graphite theme in NixOS?

Aleksanaa commented 8 months ago

I'm not sure. Have you restarted your desktop environment (like logout and login again)? Thunar theming does work for me, but I'm not using xfce4.

D3vil0p3r commented 8 months ago

Yes I restarted. I noted it applies correctly on Thunar if I am on GNOME (as shown in the images above), but not if I am in XFCE... Maybe should I use xfconf settings? Is it possible to deploy by .nix file with home-manager the following xfconf settings? Maybe they could solve the issue in XFCE:

    xfconf-query -c xsettings -p /Net/ThemeName -s "$theme_name"
    xfconf-query -c xsettings -p /Net/IconThemeName -s "$icon_theme"
    xfconf-query -c xsettings -p /Gtk/CursorThemeName -s "$cursor_theme"
    xfconf-query -c xfwm4 -p /general/theme -s "Everblush-xfwm"

    # Iterate through the monitors and set the wallpaper
    for x in $(xfconf-query -c xfce4-desktop -lv | grep last-image | awk '{print $1}'); do xfconf-query -c xfce4-desktop -p $x -s $background_theme; done
Aleksanaa commented 8 months ago

Yes, xfconf.settings in home-manager.

romildo commented 8 months ago

I have noticed in XFCE that the selected theme in Appearance is not correctly applied if xsettingsd is running. In this case the theme specified in the xsettingsd configuration is applied.

In my setup I use xsettingsd to configure simple desktops or window managers that does not have a specific tool for this purpose.

After disabling xsettingsd, theme selecting in XFCE works as expected, and the Graphite theme can be applied successfully.

D3vil0p3r commented 8 months ago

Yes, you are correct. I applied xfconf.settings expression to apply Graphite.