After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 779266 - Adwaita.css is not loaded if theme is Adwaita-dark (via gnome-themes-standard), probably should be
Adwaita.css is not loaded if theme is Adwaita-dark (via gnome-themes-standard...
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
3.22.x
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-26 18:47 UTC by Daniel Boles
Modified: 2017-02-26 22:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
app: Load Adwaita.css if theme name = Adwaita-dark (1.58 KB, patch)
2017-02-26 20:48 UTC, Daniel Boles
none Details | Review
application: Load Adwaita.css for Adwaita-dark (1.32 KB, patch)
2017-02-26 21:20 UTC, Daniel Boles
committed Details | Review
application: Load Adwaita.css for Adwaita-dark (1.32 KB, patch)
2017-02-26 22:18 UTC, Daniel Boles
committed Details | Review
application: Load Adwaita.css for Adwaita-dark (1.32 KB, patch)
2017-02-26 22:20 UTC, Daniel Boles
committed Details | Review

Description Daniel Boles 2017-02-26 18:47:31 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.
Comment 1 Ernestas Kulik 2017-02-26 19:41:07 UTC
(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.
Comment 2 Daniel Boles 2017-02-26 19:49:23 UTC
(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).
Comment 3 Ernestas Kulik 2017-02-26 19:59:51 UTC
Oh, okay, I finally understand you. Feel free to whip up a patch. Shouldn’t be more that a single line.
Comment 4 Ernestas Kulik 2017-02-26 20:05:54 UTC
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.
Comment 5 Daniel Boles 2017-02-26 20:14:03 UTC
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"
Comment 6 Daniel Boles 2017-02-26 20:41:43 UTC
(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 :)
Comment 7 Daniel Boles 2017-02-26 20:48:55 UTC
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"
Comment 8 Ernestas Kulik 2017-02-26 21:03:50 UTC
(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.
Comment 9 Ernestas Kulik 2017-02-26 21:15:13 UTC
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”.
Comment 10 Daniel Boles 2017-02-26 21:20:33 UTC
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"
Comment 11 Daniel Boles 2017-02-26 21:21:52 UTC
(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.
Comment 12 Ernestas Kulik 2017-02-26 21:28:42 UTC
Review of attachment 346772 [details] [review]:

Cool, LGTM.
Comment 13 Daniel Boles 2017-02-26 21:30:00 UTC
Thanks. Just to master, or also to 3.22?
Comment 14 Ernestas Kulik 2017-02-26 21:36:27 UTC
(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.
Comment 15 Ernestas Kulik 2017-02-26 21:38:42 UTC
(In reply to Ernestas Kulik from comment #14)
>
> Adwaita-dark isn’t in gnome-themes-standard 3.22

Wrong again.
Comment 16 Daniel Boles 2017-02-26 21:39:46 UTC
yeah, it's in the 3.22.2 release, though not 3.22.1
Comment 17 Carlos Soriano 2017-02-26 22:10:19 UTC
It's safe, fine for both versions :)
Comment 18 Daniel Boles 2017-02-26 22:18:21 UTC
The following fix has been pushed:
78a1562 application: Load Adwaita.css for Adwaita-dark
Comment 19 Daniel Boles 2017-02-26 22:18:28 UTC
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"
Comment 20 Daniel Boles 2017-02-26 22:20:02 UTC
The following fix has been pushed:
31b30bc application: Load Adwaita.css for Adwaita-dark
Comment 21 Daniel Boles 2017-02-26 22:20:08 UTC
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"
Comment 22 Daniel Boles 2017-02-26 22:22:01 UTC
Thanks! Pushed to both.

(and sorry for the spam - seems I need to use git-bz differently)