From 74287edb6c60c86dea338a87e4aa863e44a31c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Janou=C5=A1ek?= Date: Wed, 12 Feb 2020 19:58:38 +0100 Subject: [PATCH] Normalize the default GTK theme Issue: tiliado/nuvolaruntime#586 --- src/gtk/DesktopShell.vala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gtk/DesktopShell.vala b/src/gtk/DesktopShell.vala index 990347a..5994f4a 100644 --- a/src/gtk/DesktopShell.vala +++ b/src/gtk/DesktopShell.vala @@ -27,6 +27,8 @@ using Drt; namespace Drtgtk { const string THEME_ADWAITA = "Adwaita"; +const string THEME_ADWAITA_DARK = "Adwaita-dark"; + public abstract class DesktopShell: GLib.Object { private static DesktopShell? default_shell = null; private static GenericSet shells = null; @@ -83,7 +85,12 @@ public abstract class DesktopShell: GLib.Object { */ public static string get_gtk_theme() { string? theme = Gtk.Settings.get_default().gtk_theme_name; - return theme != "" ? theme : "Adwaita"; + if (theme == "" || theme == THEME_ADWAITA_DARK) { + // Normalize the default theme or dark theme preference won't work. + theme = THEME_ADWAITA; + set_gtk_theme(theme); + } + return theme; } /**