Changing thunar icon theme

Hi, I have been having some trouble changing thunar’s icon theme on hyprland. Since thunar is written in gtk I changed my gtk icon theme to Papirus Dark, but it had not affect on thunar. According to fastfetch my gtk icon theme has successfully been set to Papirus Dark. Since I am using hyprland I don’t have the full xfce DE installed and intend to use thunar by it self. I should also mention that I am using stylix, is there maybe a way to set my icon theme through stylix? Here is my full config.

This is where I set my gtk icon theme with home-manger:

{ pkgs, lib, ... }:

{
  gtk.enable = true;
  gtk.iconTheme.package = lib.mkForce pkgs.papirus-icon-theme;
  gtk.iconTheme.name = lib.mkForce "Papirus Dark";
}

This is my thunar nix module:

{
  programs.xfconf.enable = true;
  services.gvfs.enable = true;
  services.tumbler.enable = true;
}

Any help would be greatly appreciated. Thanks

1 Like

Does it take a new user session to get applied?

No I dont’t think so. I’ve killed hypland and restarted it and I have rebooted my entire machine without success. I don’t have a display manager installed, I autologin and then launch hyperland from a tty could this be causing an issue? Maybe I misunderstood you? I should also mention I tried Nautilus to see if it’s icons had changed but it was also using the default icons so the issue is not thunar specific.

Hello all,

I’m also facing icon display issues with Hyprland as my window manager. While fastfetch and rofi show the correct icons, Thunar fails to display them properly. I will take a look at other file manager and see if it is just Thunar having this issue.

Any insights on where to focus our troubleshooting would be greatly appreciated.

Noticing that this issue also occurs on Nemo & pcmanfm. It seems to have nothing to do with the filemanager itself.

Having the same issue with sway. Any updates?

Hello NixOS Community!
Pardon the revival of an old thread, but long story short I went down a very long rabbit hole working on an issue that led me down to this thread while google dorking.
I’m posting here because I’m pretty sure I resolved the issue, and in case anyone else lands on this page while diagnosing similar problems, I hope my solution and diagnosis can provide you a fix.

Making Hyprland + GTK Play Nicely

Both the beauty and the pain of Linux, especially on build-it-yourself wms / compositors that don’t provide a complete “set” of pre-built stuff like hyprland is (not) knowing what you might be missing, or how some things prefer to communicate to each other along with their defaults.

I essentially was trying to get a custom icon theme to work system-wide, and the intention was to handle this through gtk, since a lot of components use that to pull settings and configs from. I found what I thought were the settings that were being defaulted to under ~/.config/gtk-{3,4}.0/settings.ini. Changed those. No dice. Which was odd, because all the paths that gtk should be looking for the ini files were there and in the right places, according to other posts across the internet. Tried making and adding it in /etc/xdg/gtk-4.0/. Still nothing.

I needed to do more digging.

I made gpt whip up this little script that helped me see what environment variables were set, what gtk’s defaults are in the system, what (if any) providers are…providing, icon-theme search paths (you can replace this w/ any setting you’re diagnosing), and the final result of the property currently being shown/active (again, you can change this to what you’re looking for)

nix-shell -p python3Packages.pygobject3 gtk4 --run '
python3 - << "PY"
import gi, os, sys

gi.require_version("Gtk", "4.0")
gi.require_version("Gdk", "4.0")
from gi.repository import Gtk, Gdk

# 1. Print Environment Vars related to GTK / XDG
print("=== Environment Variables Related to GTK / XDG ===")
for var in sorted(os.environ):
    if any(pref in var for pref in ("GTK_", "XDG_", "GDK_", "GIO_", "DESKTOP_")):
        print(f"{var}={os.environ[var]}")
print()

# 2. Grab the default Gtk.Settings and print all its properties
settings = Gtk.Settings.get_default()
if settings is None:
    print("ERROR: Gtk.Settings.get_default() returned None")
    sys.exit(1)

print("=== Gtk.Settings Properties (name = value) ===")
for prop in settings.list_properties():
    name = prop.name
    try:
        val = settings.get_property(name)
    except Exception:
        val = "<unreadable>"
    print(f"  {name} = {val!r}")
print()

# 3. Show which provider types are in use (GioSettingsProvider, XSettingsProvider, etc.)
print("=== Gtk.Settings Providers (GObject type names) ===")
provider_list = getattr(settings, "_provider_list", None)
if provider_list:
    for provider in provider_list:
        print("  •", type(provider).__name__)
else:
    print("  • (no _provider_list attribute – GTK is not using any provider!)")
print()

# 4. Show the actual icon‐theme search path GTK is using
icon_theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default())
print("=== IconTheme Search Path (directories GTK will scan) ===")
for p in icon_theme.get_search_path():
    print("  •", p)
print()

# 5. Show the final ACTIVE icon‐theme‐name property:
print("==> Final ACTIVE icon‐theme‐name:")
print(settings.get_property("gtk-icon-theme-name"))
PY
'

Interestingly, I noticed something odd; the gtk defaults did not match what was in the ini file I had. Which, again, shouldn’t be happening. Plus, it was still picking up the original base icon theme, even though I explicitly set all kinds of envs and settings to tell it otherwise. It also, notably, had no providers listed, so I know there wasn’t anything accidentally interfering with any of my manual settings. However, it did kind of confuse me. If I had no providers, how come stuff displays?

Now, I’m new to NixOS (I fucking love it though btw), but it allegedly builds things in a way that’s dependency-safe, no? So, something (I’m suspecting hyprland) when built through nix must be pulling and activating some stuff, but not everything (and not enough to run some commands needed).

The Fix

Note I’m not using Home-manager or whatever, I’m doing everything in a plain configuration.nix file that I’m eventually going to turn into a flake. That being said, add these first:

services.gvfs.enable = true; # <- this gives the full feature set for thunar
...
programs.xfconf.enable = true;
programs.dconf.enable = true; # <- add this after environment.systemPackages, otherwise it won't be found

I’ve seem some mention dconf may be enabled by default if other things are enabled I guess? Idk do it anyway just to be safe (it never appeared for me personally until i enabled it).
Also add dconf-editor pkg to test out if the changes it makes works or not.
I noticed when I ran dconf-editor, it displayed the actual settings I found from the earlier code’s output! Whew! I was finally getting somewhere!

When that changed the settings across the board (including for thunar), I knew I’ve found the culprit.

Idk why, but even though I never specified any kind of gnome pkg in my nix config, changing the settings had to be managed under gsettings, which was hard to do without any kind of gnome stuff (until I got dconf-editor). I suspect maybe it has something to do with what Hyprland ships with by default (or lack thereof) when a nix declaration builds it? Idk I haven’t gone through NixOS’s intricacies with a fine-toothed comb yet, that’s just my best guess.

Anyways, to make any changes you want persist from what you made from dconf-editor or dconf, add this to your configuration.nix file:

programs.dconf.profiles.user.databases = [
  {
    settings."org/gnome/desktop/interface" = {
      (place setting key/values here)
  }
];

source

Et voila, Customize your defaults to your heart’s content.

This isn’t exclusive to Thunar, this fixes settings that are missing across any app using GTK

1 Like

I managed to get it working with this config code:

  gtk = {
    enable = true;
    iconTheme = {
      name = "Papirus-Dark";
      package = pkgs.papirus-icon-theme;
    };
    # override the default GTK-Theme from Stylix
    theme = lib.mkForce {
      name = "Nightfox-Dark";
      package = pkgs.nightfox-gtk-theme;
    };
  };

The thunar part looks like this:

      programs = {
        thunar = {
          enable = true;
          plugins = with pkgs.xfce; [
            thunar-archive-plugin
            thunar-volman
          ];
        };
        # enable preference changes saving for xfce/thunar
        xfconf.enable = true;
        # test for archive plugin and neovim wrapper
        file-roller.enable = true;
        # add this after environment.systemPackages, otherwise it won't be found
        dconf.enable = true;
      };
      services = {
        gvfs.enable = true;
        tumbler.enable = true;
      };

      environment.systemPackages = with pkgs; [
        xdg-utils
      ];