Setting theme for gnome apps to dark when gnome desktop is disabled

How can I set the theme for gnome applications to dark, when the desktop environment itself is disabled? I have been using a tiling window manager for a while now and recently disabled the gnome desktop environment, as I have no use for it anymore.
Most of the GTK programs I use could be set to dark in dconf with home-manager:

dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";

However, all gnome applications I would still like to use are all in light mode after disabling the DE. When I set up gnome in the past, I dumped all the related dconf and made it declarative/static with home-manager and that worked perfectly fine. I had a look around that config, but found no more settings related to theming or color-schemes.
Enabling the DE again (now without my old config and without any extensions) and switching to dark mode in the gnome settings still works perfectly fine, but that defeats the point of trying to get rid of gnome while not using it.

Do I maybe need to set a shell theme, even if I don’t even have a gnome shell anymore? Is there
another secret setting to be set in order to make the programs dark? Or is there a gnome component that still needs to be enabled in my system config to make it work without the DE itself?

Any help is greatly appreciated, thanks :)

Set programs.dconf.enable = true; in your NixOS config.

Sadly, does not change anything. I already checked if the dconf values are actually set by hm some time ago and they are. Setting anything in dconf.settings (in hm) would not make sense anyway if programs.dconf (in system) is not enabled. Nemo file manager for example was also light after removing the gnome DE, but setting dconf.settings."org/gnome/desktop/interface".color-scheme fixed that already. Things like gnome-clocks are still light.

1 Like

You might honestly have more luck asking upstream, though knowing them they’ll likely tell you to just use gnome ^^ Have you considered finding non-gnome alternatives for these applications? Not trying to be facetious, gnome apps just don’t integrate well outside gnome.

I think around here only jtotnar has a chance of knowing how to fix this. Sounds like gnome ironically doesn’t respect gtk standards either.

I think at some point gnome — as they are wont to do — went “our way or highway” and removed handling of that dconf value in libadwaita. So this is working as it should, go use gnome if you don’t like it! P:

Or, taking advantage of the fact that you’re on NixOS you can create a patched version of libadwaita and use system.replaceDepedencies override them (it’s better to create a new package like that, instead of overriding the existing one, because it saves you a ton of rebuilds as far as I understand it):

system.replaceDependencies = {
  replacements = [
    {
      oldDependency = pkgs.libadwaita;
      newDependency = pkgs.customPackages.libadwaita-with-theming;
    }
  ];
};

The patch that currently works for me is this (applied with a simple overrideAttrs to add it to the patch list):

From 961dae8e3f3a16fb319e9e170d6531e4b27eab34 Mon Sep 17 00:00:00 2001
From: snip
Date: Sat, 17 May 2025 12:28:50 +0200
Subject: [PATCH] Re-enable legacy styling

---
 src/adw-style-manager.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/adw-style-manager.c b/src/adw-style-manager.c
index 1fc5159f..5faae65e 100644
--- a/src/adw-style-manager.c
+++ b/src/adw-style-manager.c
@@ -431,10 +431,30 @@ notify_high_contrast_cb (AdwStyleManager *self)
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_HIGH_CONTRAST]);
 }

+static void
+adw_style_manager_theme_changed(GSettings *settings, const char *key, GdkDisplay *display)
+{
+  char* theme = g_settings_get_string(settings, "gtk-theme");
+  char* color_scheme = g_settings_get_string(settings, "color-scheme");
+
+  if(!theme) {
+    theme = "Adwaita-empty";
+  }
+
+  gboolean is_dark_variant =    NULL != strstr(theme, "-dark")
+                             || NULL != strstr(theme, "-Dark")
+                             || 0 == strcmp(color_scheme, "prefer-dark");
+
+  g_object_set(gtk_settings_get_for_display(display),
+               "gtk-theme-name", theme,
+               "gtk-application-prefer-dark-theme", is_dark_variant, NULL);
+}
+
 static void
 adw_style_manager_constructed (GObject *object)
 {
   AdwStyleManager *self = ADW_STYLE_MANAGER (object);
+  bool use_adwaita_theming = !adw_is_granite_present () && !g_getenv ("GTK_THEME");

   G_OBJECT_CLASS (adw_style_manager_parent_class)->constructed (object);

@@ -456,7 +476,7 @@ adw_style_manager_constructed (GObject *object)
                              self,
                              G_CONNECT_SWAPPED);

-    if (!adw_is_granite_present () && !g_getenv ("GTK_THEME")) {
+    if (use_adwaita_theming) {
       g_object_set (self->gtk_settings,
                     "gtk-theme-name", "Adwaita-empty",
                     NULL);
@@ -535,6 +555,17 @@ adw_style_manager_constructed (GObject *object)
   update_dark (self);
   update_fonts (self);
   update_stylesheet (self, UPDATE_ALL);
+
+  if (self->display && use_adwaita_theming) {
+    GSettingsSchemaSource *schema_source =
+      g_settings_schema_source_get_default();
+    GSettingsSchema *schema = g_settings_schema_source_lookup(
+      schema_source, "org.gnome.desktop.interface", true);
+    GSettings *interface_settings = g_settings_new_full(schema, NULL, NULL);
+
+    adw_style_manager_theme_changed(interface_settings, "gtk-theme", self->display);
+    g_signal_connect (interface_settings, "changed", G_CALLBACK (adw_style_manager_theme_changed), self->display);
+  }
 }

 static void
--
2.49.0

This gets most of the GTK-based stuff follow theming for me — the only downside is that things you’ll run ad-hoc with nix run nixpkgs#some-app will keep their original broken libadwaita.

Have you tried Stylix? It does work for gnome apps as far as I can remember.

For me (not using Gnome) it works by a combination of setting the theme to Adwaita-dark with nwg-look and shell aliases like:

# fish aliases
alias gnome-dark 'gsettings set org.gnome.desktop.interface color-scheme prefer-dark'
alias gnome-light 'gsettings set org.gnome.desktop.interface color-scheme prefer-light'

My observation is also that Gnome and its apps are ignoring the theme set by Gtk.

Have you considered finding non-gnome alternatives for these applications? Not trying to be facetious, gnome apps just don’t integrate well outside gnome.

That’s okay, I certainly understand your point :)
So far, I only had a short look around, but decided to stick with the gnome apps for now. I didn’t want to spend too much time searching for the perfect replacement, so I just wanted to have the theme of them right. Maybe I will have a look again sometime.

1 Like

Yes, I have tried Stylix already, as I am planning to use it in the future when I come around to actually theming my system. Sadly that didn’t successfully build for me with some errors (I don’t remember what the supposed problem was, was a bit ago by now) and I didn’t want to look into it for too long…
For now, I only wanted everything I have to be dark.

I have an update by now: I have got the dark Adwaita theme to work now, using an interesting method, which is kind of experimental.
All I did now was globally set the environment variable ADW_DISABLE_PORTAL=1 and added the GTK XDG Desktop Portal, like so:

environment.sessionVariables = {
  ADW_DISABLE_PORTAL = 1;
};
xdg.portal.extraPortals = with pkgs; [
  xdg-desktop-portal-gtk
];

I have discovered on the Arch wiki, that one can set the environment variable in order to override libadwaita’s default behavior to respect gsettings/dconf. When I first tried this, I ran into the problem that file dialogs in GTK programs would not open. The wiki entry says, setting ADW_DISABLE_PORTAL is for not using the portal, but when i added the xdg-desktop-portal-gtk I have gotten back the file dialogs.
I will say this is experimental, because so far it works for me, but I don’t know what else could be broken that maybe is not fixed by using the portal.

Another method is to set GTK_THEME="Adwaita:dark". This overrides whatever theme gtk applications would normally use, but I read somewhere that this is only really meant for debug use. Also, when trying this using a terminal, the Adwaita theme had a different look. That is the more skeuomorphic version I know from other programs, and not the flat version I am used to from gnome and it’s apps. When using ADW_DISABLE_PORTAL and the portal, the theme is the flat one, which is what I wanted.
Lastly, using the method I am using now might be nicer when using stylix or generally setting a different gtk-theme, because it does not force a specific theme, but rather overrides where programs look for what theme to use (as far as I understand it).

1 Like