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 654108 - settings.ini "gtk-theme-name" is not honored
settings.ini "gtk-theme-name" is not honored
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: .General
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-07-06 17:20 UTC by Pacho Ramos
Modified: 2014-03-22 17:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch to fall back to settings.ini theme if xsettings theme fails to load (2.81 KB, patch)
2012-03-15 04:11 UTC, Alexandre Rostovtsev
none Details | Review
same as above, but for gtk-3.3.x git master (2.77 KB, patch)
2012-03-15 04:23 UTC, Alexandre Rostovtsev
none Details | Review

Description Pacho Ramos 2011-07-06 17:20:04 UTC
We are having some problems under Gentoo to set Adwaita as default theme for gtk3 apps instead of current (ugly) default one.

After reading http://developer.gnome.org/gtk3/3.0/GtkSettings.html#GtkSettings.properties

looks like having a settings.ini file under /etc/gtk-3.0 or .config/gtk-3.0 with the following content:

[Settings]
gtk-theme-name = Adwaita

should work, but it doesn't change anything.

Running "strace" with a gtk3 app (evilvte), the following is seen:

access("/home/pacho/.config/gtk-3.0/settings.ini", F_OK) = 0
open("/home/pacho/.config/gtk-3.0/settings.ini", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=36, ...}) = 0
read(6, "[Settings]\ngtk-theme-name = Adwa"..., 4096) = 36
read(6, "", 4096)                       = 0
close(6)                                = 0
stat("/home/pacho/.config/gtk-3.0/gtk.css", 0x7fffd3d89740) = -1 ENOENT (No such file or directory)
access("/home/pacho/.themes/Shiki-Gentoo/gtk-3.0/gtk.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/themes/Shiki-Gentoo/gtk-3.0/gtk.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/themes/Shiki-Gentoo/gtk-3.0/settings.ini", F_OK) = -1 ENOENT (No such file or directory)
access("/home/pacho/.themes/Default/gtk-3.0/gtk-keys.css", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/themes/Default/gtk-3.0/gtk-keys.css", F_OK) = 0
open("/usr/share/themes/Default/gtk-3.0/gtk-keys.css", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=86, ...}) = 0
mmap(NULL, 86, PROT_READ, MAP_PRIVATE, 6, 0) = 0x7f13c05a8000

Looks like it doesn't try to load the theme from /usr/share

What are we doing wrong? What is the proper way to set Adwaita as default gtk3 theme when no other is selected?

Thanks a lot for your help
Comment 1 Matthias Clasen 2011-07-11 01:05:12 UTC
If I had to guess, I would say that you are running an xsettings manager in your session (such as gnome-settings-daemon), which sets the theme name setting to 'Shiki-Gentoo'. What does

gsettings get org.gnome.desktop.interface gtk-theme

say ?
Comment 2 Pacho Ramos 2011-07-11 10:38:23 UTC
Yes, sorry for not updating this here :S

I was talking on #gtk IRC channel some days ago but, sadly, the solution
is probably more far than before :(

I attach the log. As you can see, the problem is caused by setting not
being honored because of gnome-settings-daemon (from gnome2) being
running (this would also affect to anyone running a desktop with a
settings daemon :S)

As you can read in the log, I have tried some ways of setting Adwaita as
default without success. Finally, I have even tried to recompile gtk+3
changing manually the default from Raleigh to Adwaita:
sed -i -e 's/Raleigh/Adwaita/' gtk/gtksettings.c

but it doesn't work either

I have also tried to remove /usr/share/themes/{Default,Raleigh} and
still the same (probably because both themes are not really themes, but
simply go to unthemed gtk+)

I am completely out of ideas for trying to make Adwaita be used when selected theme doesn't have gtk-3.0 support at all :(

I have also tried to change gsettings setting but, even with:

$ gsettings get org.gnome.desktop.interface gtk-theme
'Adwaita'

It's still the same :S

Thanks a lot for your help
Comment 3 Matthias Clasen 2011-07-11 18:18:19 UTC
If you have a settings manager running, that is the authoritative source for settings. settings.ini files in /etc and ~/.config have a lower priority. 

Since gtk2 and gtk3 share the same settings key for the the theme name, you cannot have them use different themes
Comment 4 Pacho Ramos 2011-07-12 10:45:40 UTC
And wouldn't be a way to set a different them when gtk-3.0 subdir is not available at all? I can make it locally but not system-wide:
- If I link ~/.config/gtk-3.0 to gtk-3.0 directory provided by Adwaita theme, it works
- But I cannot do the same for /etc/gtk-3.0 (or maybe it should be done on a different config dir?)

The idea would be to try to fallback to another theme when selected one doesn't have gtk-3.0 support at all
Comment 5 Alexandre Rostovtsev 2012-03-15 04:11:51 UTC
Created attachment 209801 [details] [review]
proposed patch to fall back to settings.ini theme if xsettings theme fails to load

If a gtk3 application is run in gnome2 and the settings daemon uses xsettings to request a gtk2 theme with no gtk3 version (which is the case by default), then instead of failing to load any theme, we should attempt to fall back to the theme specified in gtk3's settings.ini files. This would allow distributions to specify a sane fallback theme for gtk3 (e.g. Adwaita) in /etc/gtk-3.0/settings.ini which will be picked up by users of old gtk2-based destkop environments who are using a gtk2-only theme such as Clearlooks.

Of course, if the theme selected by the settings daemon does have a valid gtk3 version, then we should respect it, and ignore the theme specified in /etc/gtk-3.0/settings.ini.

Attached is a simple patch which enables this behavior.
Comment 6 Alexandre Rostovtsev 2012-03-15 04:23:31 UTC
Created attachment 209802 [details] [review]
same as above, but for gtk-3.3.x git master

Same the patch, but for gtk-3.3.x git master (the patch in comment 5 applies only to the gtk-3-2 branch).
Comment 7 Matthias Clasen 2014-03-22 17:27:54 UTC
I'm not in favor of this. The more fallbacks we build into the system, the harder it becomes to figure out what is going on and to diagnose failures.