Skip to content

Commit 2aa4cec

Browse files
committed
Xrandr-applet-popup: Special case the GNOME themes for black text on monitor labels
1 parent 7bc681f commit 2aa4cec

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

plugins/xrandr/msd-xrandr-manager.c

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,14 +1716,15 @@ make_menu_item_for_output_title (MsdXrandrManager *manager, MateRROutputInfo *ou
17161716
{
17171717
GtkWidget *item;
17181718
GtkStyleContext *context;
1719-
GtkCssProvider *provider;
1719+
GtkCssProvider *provider, *provider2;
17201720
GtkWidget *label;
17211721
GtkWidget *image;
17221722
GtkWidget *box;
17231723
char *str;
17241724
GString *string;
17251725
GdkRGBA color;
1726-
gchar *css, *color_string;
1726+
gchar *css, *color_string, *theme_name;
1727+
GtkSettings *settings;
17271728

17281729
struct MsdXrandrManagerPrivate *priv = manager->priv;
17291730

@@ -1799,7 +1800,34 @@ make_menu_item_for_output_title (MsdXrandrManager *manager, MateRROutputInfo *ou
17991800
gtk_style_context_add_provider (context,
18001801
GTK_STYLE_PROVIDER (provider),
18011802
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
1803+
1804+
/*Deal with the GNOME themes*/
1805+
provider2 = gtk_css_provider_new ();
1806+
settings = gtk_settings_get_default();
1807+
context = gtk_widget_get_style_context (label);
1808+
g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
1809+
if (g_strcmp0 (theme_name, "Adwaita") == 0 ||
1810+
g_strcmp0 (theme_name, "Adwaita-dark") == 0 ||
1811+
g_strcmp0 (theme_name, "Raleigh") == 0 ||
1812+
g_strcmp0 (theme_name, "win32") == 0 ||
1813+
g_strcmp0 (theme_name, "HighContrast") == 0 ||
1814+
g_strcmp0 (theme_name, "HighContrastInverse") == 0){
1815+
gtk_css_provider_load_from_data (provider2,
1816+
".mate-panel-menu-bar menuitem.xrandr-applet:disabled>box>label{\n"
1817+
"color: black;\n"
1818+
"}",
1819+
-1, NULL);
1820+
gtk_style_context_add_provider(context,
1821+
GTK_STYLE_PROVIDER (provider2),
1822+
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
1823+
}
1824+
/*Keep or take this off all other themes as soon as the theme changes*/
1825+
else{
1826+
gtk_style_context_remove_provider(context, GTK_STYLE_PROVIDER (provider2));
1827+
}
1828+
18021829
g_object_unref (provider);
1830+
g_object_unref (provider2);
18031831

18041832
gtk_widget_set_sensitive (item, FALSE); /* the title is not selectable */
18051833

0 commit comments

Comments
 (0)