GNOME Bugzilla – Bug 779266
Adwaita.css is not loaded if theme is Adwaita-dark (via gnome-themes-standard), probably should be
Last modified: 2017-02-26 22:22:01 UTC
Adwaita-dark is supplied by the gnome-themes-standard package in order to provide a dark variant for GTK+ 2. The gtk+-3.0 subdirectory just contains a gtk.css that imports gtk-contained-dark.css wholesale from the shared library. So GTK+ 3 just ends up using Adwaita. Because of the different theme name (presumably required for GTK+ 2) however, the code in Nautilus that loads Adwaita-specific CSS does not get executed. It seems that in this case, that CSS should be loaded, because the same GTK+ 3 theme is used and relevant in both cases.
(In reply to Daniel Boles from comment #0) > Adwaita-dark is supplied by the gnome-themes-standard package in order to > provide a dark variant for GTK+ 2. I’m not quite sure what GTK+ 2 has to do with this. > The gtk+-3.0 subdirectory just contains a gtk.css that imports > gtk-contained-dark.css wholesale from the shared library. So GTK+ 3 just > ends up using Adwaita. > > Because of the different theme name (presumably required for GTK+ 2) > however, the code in Nautilus that loads Adwaita-specific CSS does not get > executed. The name is still Adwaita, AFAICS. And I also see the CSS file among loaded resources. > It seems that in this case, that CSS should be loaded, because the same GTK+ > 3 theme is used and relevant in both cases.
(In reply to Ernestas Kulik from comment #1) > I’m not quite sure what GTK+ 2 has to do with this. To get GTK+ 2 apps styled as I want, I must select the theme Adwaita-dark, because afaict GTK+ 2 themes can only be selected by name (not the global-dark-the,e setting). This leads to subpar theming in Nautilus, because: > The name is still Adwaita, AFAICS. And I also see the CSS file among loaded > resources. The name is not Adwaita if the user has chosen Adwaita-dark, in order to get its proper support for dark GTK+ 2 themes. So I seem to have two mutually exclusive options: * Don't use Adwaita-dark from gnome-themes-standard, so GTK+2 apps look wrong * Do use it, and then Nautilus looks wrong. My hope is that Nautilus can also load Adwaita.css if the system theme name is "Adwaita-dark", as the GTK+ 3 theme ends up being the same (but GTK+ 2 does not).
Oh, okay, I finally understand you. Feel free to whip up a patch. Shouldn’t be more that a single line.
Just to clarify another thing: how are you hitting the issue? “GTK_THEME=Adwaita-dark jhbuild run nautilus” gives me the dark variant of Adwaita, thus loading the shipped CSS.
afaict, this occurs when * I have "Adwaita-dark" set as the theme in GNOME Tweak Tool * I have any other theme selected there and run "GTK_THEME=Adwaita-dark nautilus" but seemingly _not_ when * I have "Adwaita" set in Tweak Tool and run "GTK_THEME=Adwaita-dark nautilus"
(I feel like there must be a better way to do this, e.g. having the Adwaita-dark theme actually set the GTK+ 3 theme to normal Adwaita, rather than just importing all the same CSS... but I'm acting on a presumption that there isn't, otherwise gnome-themes-standard would do it :)
Created attachment 346769 [details] [review] app: Load Adwaita.css if theme name = Adwaita-dark "Adwaita-dark" is supplied by gnome-themes-standard and has a distinct name to theme GTK+ 2. For GTK+ 3, this theme just imports gtk-contained- dark.css from the library, so it's _as if_ Adwaita was the system theme. But Nautilus only applied its Adwaita-specific CSS if the system theme name was exactly "Adwaita". So using "Adwaita-dark" meant we got Adwaita but without Nautilus' additions to it, even though they are applicable. Fix this by also loading Adwaita.css if the theme name is "Adwaita-dark"
(In reply to Daniel Boles from comment #6) > (I feel like there must be a better way to do this, e.g. having the > Adwaita-dark theme actually set the GTK+ 3 theme to normal Adwaita, rather > than just importing all the same CSS... but I'm acting on a presumption that > there isn't, otherwise gnome-themes-standard would do it :) As you can already tell by my misunderstanding the issue at first, I wasn’t even aware of the theme. GTK+ people could probably explain the reasoning behind the choice. *shrug* As far as Nautilus is concerned, I don’t really see a better way, currently.
Review of attachment 346769 [details] [review]: Looks good, thanks! Though you should drop the changes to libgd, unless you did that deliberately. Also, the subject line should say “application”, not “app”. You could make the rest of the text shorter by saying something like “load Adwaita.css for Adwaita-dark”.
Created attachment 346772 [details] [review] application: Load Adwaita.css for Adwaita-dark "Adwaita-dark" is supplied by gnome-themes-standard and has a distinct name to theme GTK+ 2. For GTK+ 3, this theme just imports gtk-contained- dark.css from the library, so it's _as if_ Adwaita was the system theme. But Nautilus only applied its Adwaita-specific CSS if the system theme name was exactly "Adwaita". So using "Adwaita-dark" meant we got Adwaita but without Nautilus' additions to it, even though they are applicable. Fix this by also loading Adwaita.css if the theme name is "Adwaita-dark"
(In reply to Ernestas Kulik from comment #9) > you should drop the changes to libgd, unless you did that > deliberately. Oops! I just fetched and pulled, but I've still not wrapped my head around git submodules yet, so there must have been a step missing. > Also, the subject line should say “application”, not “app”. You could make > the rest of the text shorter by saying something like “load Adwaita.css for > Adwaita-dark”. Sure, done.
Review of attachment 346772 [details] [review]: Cool, LGTM.
Thanks. Just to master, or also to 3.22?
(In reply to Daniel Boles from comment #13) > Thanks. Just to master, or also to 3.22? Adwaita-dark isn’t in gnome-themes-standard 3.22, so we should probably not care there. But don’t push just yet, let’s wait for Carlos to ACK my ACK. Pecking order and all that.
(In reply to Ernestas Kulik from comment #14) > > Adwaita-dark isn’t in gnome-themes-standard 3.22 Wrong again.
yeah, it's in the 3.22.2 release, though not 3.22.1
It's safe, fine for both versions :)
The following fix has been pushed: 78a1562 application: Load Adwaita.css for Adwaita-dark
Created attachment 346776 [details] [review] application: Load Adwaita.css for Adwaita-dark "Adwaita-dark" is supplied by gnome-themes-standard and has a distinct name to theme GTK+ 2. For GTK+ 3, this theme just imports gtk-contained- dark.css from the library, so it's _as if_ Adwaita was the system theme. But Nautilus only applied its Adwaita-specific CSS if the system theme name was exactly "Adwaita". So using "Adwaita-dark" meant we got Adwaita but without Nautilus' additions to it, even though they are applicable. Fix this by also loading Adwaita.css if the theme name is "Adwaita-dark"
The following fix has been pushed: 31b30bc application: Load Adwaita.css for Adwaita-dark
Created attachment 346777 [details] [review] application: Load Adwaita.css for Adwaita-dark "Adwaita-dark" is supplied by gnome-themes-standard and has a distinct name to theme GTK+ 2. For GTK+ 3, this theme just imports gtk-contained- dark.css from the library, so it's _as if_ Adwaita was the system theme. But Nautilus only applied its Adwaita-specific CSS if the system theme name was exactly "Adwaita". So using "Adwaita-dark" meant we got Adwaita but without Nautilus' additions to it, even though they are applicable. Fix this by also loading Adwaita.css if the theme name is "Adwaita-dark"
Thanks! Pushed to both. (and sorry for the spam - seems I need to use git-bz differently)