I’m making a theme switcher for my setup, and I walked straight into a roadblock called libadwaita. It prevents official GNOME apps from getting themed unless you put files into ~/.config/gtk-4.0. The problem is that I then need to restart every single GNOME app to apply the new theme which is very annoying.
I found out that the Linux Mint team forked libadwaita [ GitHub - linuxmint/libadwaita: Patched version of libAdwaita in Linux Mint - Adds theme support. ] and added theming support. You can change themes on the fly by just running gsettings set org.gnome.desktop.interface gtk-theme “your theme”.
I made an overlay so all apps I install will run with this patched verion:
{
nixpkgs.overlays = [
(final: prev: {
libadwaita = prev.libadwaita.overrideAttrs (oldAttrs: {
version = "1.7-mint";
src = final.fetchFromGitHub {
owner = "linuxmint";
repo = "libadwaita";
rev = "8da81dd889b2b7b936ee3aab45c8d1ceb2f4413e";
hash = "sha256-bnQiiTKregeiFYbzOwbCrBGyZouVC2mN0Z+pIqD4EuY=";
};
});
})
];
}
and other one for Nautilus so it uses exact same version as Linux Mint does (the newest version doesn’t work as wel):
{ lib, ... }:
{
nixpkgs.overlays = [
(final: prev: {
nautilus = prev.nautilus.overrideAttrs (oldAttrs: rec {
version = "46.4";
src = final.fetchurl {
url = "mirror://gnome/sources/nautilus/${lib.versions.major version}/nautilus-${version}.tar.xz";
hash = "sha256-sN9I4PXsbcnfQUN+/e2PEbrO8voXwySwNsumvyUPYk0=";
};
});
})
];
}
You can see that nautilus is indeed using that version of the library:
> cat /proc/$(pgrep nautilus)/maps | grep adwaita
7ff127600000-7ff12771d000 r--p 00000000 103:06 17434050 /nix/store/8cm2y528hx0mz7grwvr4k8i6yf56nbw1-libadwaita-1.7-mint/lib/libadwaita-1.so.0
7ff12771d000-7ff1277e1000 r-xp 0011d000 103:06 17434050 /nix/store/8cm2y528hx0mz7grwvr4k8i6yf56nbw1-libadwaita-1.7-mint/lib/libadwaita-1.so.0
7ff1277e1000-7ff127828000 r--p 001e1000 103:06 17434050 /nix/store/8cm2y528hx0mz7grwvr4k8i6yf56nbw1-libadwaita-1.7-mint/lib/libadwaita-1.so.0
7ff127828000-7ff12782f000 r--p 00227000 103:06 17434050 /nix/store/8cm2y528hx0mz7grwvr4k8i6yf56nbw1-libadwaita-1.7-mint/lib/libadwaita-1.so.0
7ff12782f000-7ff127830000 rw-p 0022e000 103:06 17434050 /nix/store/8cm2y528hx0mz7grwvr4k8i6yf56nbw1-libadwaita-1.7-mint/lib/libadwaita-1.so.0
and all my themes does have folders mentioned in the repository:
cinnamon gtk-2.0 gtk-4.0 libadwaita-1.5 metacity-1 xfwm4
gnome-shell gtk-3.0 index.theme libadwaita-1.7 plank
the libadwaita-1.5 and libadwaita-1.7 folders are straight from Linux Mint installation on a VM.
Despite all that, Nautilus is still using the Adwaita theme. Any ideas?