On Wed, 28 Jan 2026 18:44:21 GMT, Alexander Zvegintsev <[email protected]>
wrote:
> On some systems with the GNOME desktop environment, the dark theme does not
> automatically apply to the GTK look and feel.
> This issue has been observed on Oracle Linux 10 (Gnome 47) and Fedora 42
> (Gnome 48). However, Ubuntu with the same Gnome versions is not affected.
>
> To get it working, we should manually set the
> `gtk-application-prefer-dark-theme` setting on affected systems. These
> changes work fine on Ubuntu, too.
>
>
> ---
>
> However, with this fix, the JDK will not detect a color scheme change on the
> fly (e.g., from light to dark when GTK LaF is active). The theme change will
> only apply if you switch to a different LaF and then back to GTK.
>
> Normally we would subscribe to `changed::color-scheme` signal to detect this
> change:
>
>
> static void on_color_scheme_changed(GSettings *settings, gchar *key, gpointer
> user_data) {
> gchar *value = g_settings_get_string(settings, key);
> g_print("Color scheme changed: %s\n", value);
> g_free(value);
> }
> ...
> GSettings *settings = g_settings_new("org.gnome.desktop.interface");
> g_signal_connect(settings, "changed::color-scheme",
> G_CALLBACK(on_color_scheme_changed), NULL);
> ...
> g_object_unref(settings);
>
>
> However, it requires a running GTK loop, which we do not have.
> As a workaround, we could try finding a place in our code where we can check
> for a color scheme change to avoid introducing the GTK loop.
> This issue is filed as
> [JDK-8376605](https://bugs.openjdk.org/browse/JDK-8376605)
>
> ---
>
> Testing looks good.
maybe we should provide a way to set this by the application? similar to how we
did on macOS?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29469#issuecomment-3814636643