GNOME Bugzilla – Bug 765687
White background on desktop after switching to Adwaita
Last modified: 2016-09-09 13:02:04 UTC
Nautilus adds both "Adwaita.css" and "nautilus.css" with application level priority [1] and gtk seems to always give the provider added last a higher priority in such a case. Usually this works fine, because "Adwaita.css" is added before "nautilus.css" and "nautilus.css" is what turns the background transparent. But when changing themes, this can break, because only "Adwaita.css" is being removed/added which can result in a situation where "Awaita.css" is the one added last. This would cause the ".nautilus-window" selector to change the background of the desktop to the base color rather than transparent. One way to trigger this is to change the theme and then change it back to Adwaita while nautilus is running and showing desktop icons. So depending on whether the gtk behavior regarding the priority is correct, there are different ways of fixing this: If the gtk behavior is correct, then "nautilus.css" could always be reloaded along with "Adwaita.css" or it could be loaded with "GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 100" priority. Both solutions seem like ugly hacks to me, but I think the first solution seems a bit saner. Or maybe the ".nautilus-window" class could be removed from the desktop window. If this is a bug in gtk and the priority of the selectors should depend on their specificity alone rather than the order in which the providers have been added, that means that there is a bug in the "nautilus.css" being covered up by this. "nautilus.css" uses an element selector ("nautilus-desktop-window") while "Adwaita.css" uses a class based selector (".nautilus-window") to change the background. However class selectors always take priority over element selectors and nautilus-desktop-window also has the ".nautilus-window" class. So the fact, this is currently working is due to "nautilus.css" being loaded last (except after theme changes) and thereby taking priority. So once gtk fixed this would need to be fixed in nautilus by changing the selectors in "nautilus.css" to use "nautilus-desktop-window.nautilus-window". (Some of the selector names are 3.20 specific, but the general idea should be the same for master) [1] https://git.gnome.org/browse/nautilus/tree/src/nautilus-application.c?h=gnome-3-20&id=a57096df993eb44795db8ff8de47bde643c38b1e#n1075
Thanks for digging into this. Could you file a bug report to gtk+ about that? Although I guess the priorities are needed. Also, would you like to cook a patch for Nautilus?
forgot to mention, would be good for gtk to respect the selectors. If that cannot be possible, then the "reload nautilus.css alongside adwaita.css" sounds like the best approach.
I filed a bug report against gtk about the priority issue: https://bugzilla.gnome.org/show_bug.cgi?id=765737
Created attachment 326976 [details] [review] application: Fix white desktop after changing themes This is the patch using the priority + 1 solution as suggested in the gtk bug report. I've tested it on master and the 3.20 branch and it fixes the issue in both.
Patch looks good to me while gtk+ does priorities on style providers. Thanks a lot for spending the time to cook a patch and investigate! Attachment 326976 [details] pushed as 1587ee8 - application: Fix white desktop after changing themes
*** Bug 766963 has been marked as a duplicate of this bug. ***
Hi I get the same error on arch linux with gnome 3.20.2 bye
*** Bug 769132 has been marked as a duplicate of this bug. ***
When I got this issue previously it was not with a white background, but with this grey one: https://launchpadlibrarian.net/262110959/Background_Not_Shown.png Anyhow, the patch fixed my issue, however now that I have installed the latest version of the Numix GTK Theme it is back, and doesn't go even if I change back to Adwaita now, which previously did fix the issue. The first time it happened was when I changed to Numix, when I changed back to Adwaita that seemed to fix the issue, and it did go on and off with the Numix theme, so it wasn't present the whole time at first. But now, and I think it did coincide with me restarting an unresponsive Nautilus, no matter what I do, restarting gnome-shell, restarting Nautilus, changing the GTK theme back to Adwaita, nothing, it is now constantly grey, though not in the Activities Overview, nor in the gnome-control-center "Background" part, they all show it as it is meant to be. Although if I am to end the Nautilus process, then my desktop background shows as it is meant to everywhere. So should this bug be reopened? Or should I file a new one? Or...?
Though to make it clear, when starting Nautilus again the issue does return. But it is not present when Nautilus is not either.
If I end the Nautilus process and then start it from Terminal this is the output: (nautilus:11557): Gtk-WARNING **: Failed to register client: GDBus.Error:org.gnome.SessionManager.AlreadyRegistered: Unable to register client Initializing nautilus-dropbox 2015.10.28 (nautilus:11557): Gtk-WARNING **: Theme parsing error: <broken file>:1:0: Failed to import: The resource at '/org/gnome/libgd/tagged-entry/default.css' does not exist Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: mkdir failed on directory /var/run/samba/msg.lock: Permission denied net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory Please ask your system administrator to enable user sharing.
Let's reopen and investigate further. I understood correctly you are in 3.20.2 right?
My system tells me that I am using gnome-shell version 3.20.3, but it says that I am using Nautilus version 3.20.1. These are the latest versions available to me with my distro. Do I need to contact my distro and ask them to update the versions they provide?
(In reply to maofree from comment #7) > Hi > I get the same error on arch linux with gnome 3.20.2 > > bye Can you double check it's Nautilus 3.20.2? It took long to do this release.
(In reply to cooks.go.hungry from comment #13) > My system tells me that I am using gnome-shell version 3.20.3, but it says > that I am using Nautilus version 3.20.1. These are the latest versions > available to me with my distro. Do I need to contact my distro and ask them > to update the versions they provide? yes, although probably they are already aware. We did Nautilus release just a few days ago, not in sync with the rest of GNOME.
(In reply to Carlos Soriano from comment #14) > Can you double check it's Nautilus 3.20.2? It took long to do this release. Ubuntu 16.04 with the GNOME3 Staging PPA still has nautilus 3.20.1 but 2 weeks ago we cherry-picked https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-20&id=8c0f5970e
So what's happening? Do you need anything from me at the moment or are we waiting for something? Just this bug is really annoying me, I have to end the Nautilus process in order to see my desktop background.
Also, though this does not always seem to be the case, about half the time if I switch back to Adwaita the problem with the desktop goes away, at least temporarily.
(In reply to cooks.go.hungry from comment #17) > So what's happening? I guess we don't know. > Do you need anything from me at the moment or are we > waiting for something? Waiting to someone to investigate further I guess. I couldn't reproduce so far.
Created attachment 332882 [details] [review] nautilus.css: fix opaque desktop window after theme change The background of the window paned is not set to be transparent, which may cause it to become opaque when changing themes. This commit sets its background color in the style sheet.
This should fix the issue with Numix. Other themes may cause the same problem in other ways.
Well, until a fix for this has been pushed out. I have found that disabling desktop icons in the gnome-tweak-tool seems to fix it.
Review of attachment 332882 [details] [review]: oh I see what's going on. Thanks Ernestas!! Feel free to backport to 3.20
Attachment 332882 [details] pushed as 0f6ff85 - nautilus.css: fix opaque desktop window after theme change
*** Bug 761406 has been marked as a duplicate of this bug. ***