gnome-settings-daemon doesn't apply themes, unless I kill it and start it manually [duplicate]

I am running Ubuntu in VirtualBox (on a Windows 7 host). Several times now, the top-level menu bar, the task bar — and seemingly every system dialog — have forgotten the out-of-the-box "Ambiance" theme they conform to when I first installed the system. Window captions still preserve the theme, but pretty much nothing else does.

I have searched high and low on Google for assistance with this problem. Everything I've found suggests either running some gconf reset or deleting .gconf* .gnome* and other similar directories. I have followed all this advice and nothing works. I still get a boring Windows-95-style gray 3D look and feel. On previous occasions, after much messing around I've given up and rebooted the VM instance, and been pleasantly suprised to see the original "Ambience" theme restored throughout the UI, but invariably it disappears again some time later, usually after a reboot, so I can never figure out what I did that broke it.

Here's a sample from Ubuntu's site of what I want it to look like.

alt text

And here's a screenshot of my system as it currently looks.

alt text

Also note that my GNOME Terminals normally have a nice purple semi-translucent look, and as can be seen from the screenshot, they are now just a solid matte white.

This last time (just yesterday), trying numerous combinations all the usual tricks and rebooting several times hasn't fixed it, so here I am on SU wondering:

How do I recover the out-of-the-box theme for my Gnome/Ubuntu desktop, noting that blowing away all config files — as suggested in many places online — fails to achieve this?

It might help to know that it seems to fail either after I resize the VM instance, forcing the Ubuntu desktop to resize itself, or after I play around with Compiz settings. I haven't been able to figure out which of these it is, and it could be neither. Given the amount of pain I have had to go through to get things back to normal (and given that I am at a loss as to how to do so), it has proven difficult to definitively isolate the cause.


Solution 1:

@zpletan's answer lead to a bit of hunting around, which quickly unearthed what seems to be the root cause of my problem. It's detailed in Ubuntu Bug #574296. In summary, my Core i7 system with an SSD starts everything with sufficiently different timings that gnome-settings-daemon runs too early, bails, and leaves me mostly with a stock GTK theme.

A short sleep in /etc/xdg/autostart/gnome-settings-daemon.desktop fixes it:

Exec= bash -c "sleep 2; /usr/lib/gnome-settings-daemon/gnome-settings-daemon"

Solution 2:

I couldn't fix this problem with any of the suggested answers (the currently accepted answer worked sporadically, but usually did not work for me). I tried increasing the sleep time by a lot and it still wasn't working consistently.

However, one of the answers did point to a bug that tracks this issue, and I found a comment on the bug that solved it for me.

Here are the key bits:

First, create a bash script (I named it /etc/xdg/autostart/gnomesettingsdaemonfix.sh)

#!/bin/bash

pid=$(pgrep gnome-settings-)

while [ -n "$pid" ];
do
  pid=$(pgrep gnome-settings-)
  sleep 0
done

exit 0

Make sure it is executable (run chmod +x).

Then edit /etc/xdg/autostart/gnome-settings-daemon.desktop

Change the Exec line to:

Exec=bash -c '/etc/xdg/autostart/gnomesettingsdaemonfix.sh;/usr/lib/gnome-settings-daemon/gnome-settings-daemon'

That seems to have fixed it so far for me.

Solution 3:

Press Alt+F2 (Run Application) and run the following:

gksudo gnome-settings-daemon

Solution 4:

10.10 has this problem, but normally it happens when you install the proprietary nvidia driver. However, the solution will probably also work on a virtual machine.

Create a text file. Write in it

include "/usr/share/themes/Ambiance/gtk-2.0/gtkrc"
gtk-icon-theme-name = "ubuntu-mono-dark"

and save it in your home folder under the name .gtkrc-2.0. Restart.

If there are still elements wrong (for me it was the font), you need to add this change to the file, google for a gtk tutorial for the possible fine tunings.

Solution 5:

I have been looking for a fix for this issue for months. Apparently no one knows what causes it. This bug has existed for years and no one has fixed it.

Sometimes it happens during boot with a race condition between the first and second instances of gnome-settings-daemon, and sometimes it happens in the middle of a working desktop session when gnome-settings-daemon either stops functioning or crashes.

The only workaround I have found that seems to fix it is to type

killall gnome-settings-daemon
gnome-settings-daemon &

in a running terminal that I leave open.

Closing the terminal kills the background instance of gnome-settings-daemon and the desktop reverts to the default theme (not Ubuntu default but gnome default). Therefore I run the daemon it in the background and leave the terminal running too because the process needs its parent.