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 677803 - add option to use dark theme for all windows
add option to use dark theme for all windows
Status: RESOLVED FIXED
Product: gnome-tweak-tool
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME Tweak Tool maintainer(s)
GNOME Tweak Tool maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-06-10 09:35 UTC by William Jon McCann
Modified: 2012-07-03 16:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a switch to globally enable the dark theme preference (3.69 KB, patch)
2012-07-03 02:04 UTC, Cosimo Cecchi
none Details | Review
Add a switch to globally enable the dark theme preference (5.18 KB, patch)
2012-07-03 16:12 UTC, Cosimo Cecchi
committed Details | Review

Description William Jon McCann 2012-06-10 09:35:21 UTC
Certain types of users (say photographers for other media creation experts) would like to have a way to use the Adwaita dark theme for all windows regardless of the light/dark hints an application gives. It would be nice for the tweak tool to show this option.
Comment 1 John Stowers 2012-06-10 12:07:48 UTC
Is the recommended way to do this desktop-wide via the org.gsd.xsettings.overrides gsettings key?
Comment 2 Matthias Clasen 2012-06-10 23:29:34 UTC
I don't think there is a way to do this, currently.
This would need some GTK+ changes
Comment 3 Matthias Clasen 2012-06-11 14:48:50 UTC
Actually, I was wrong, you can do this today.

You have to set

gtk-application-prefer-dark-theme = true

in the [Settings] group in

$XDG_CONFIG_HOME/gtk-3.0/settings.ini
Comment 4 John Stowers 2012-06-11 15:17:28 UTC
(In reply to comment #3)
> Actually, I was wrong, you can do this today.
> 
> You have to set
> 
> gtk-application-prefer-dark-theme = true
> 
> in the [Settings] group in
> 
> $XDG_CONFIG_HOME/gtk-3.0/settings.ini

Ok great, seems to work here, but requires relaunching the app.

Three quick questions (I read over gtksettings.c briefly but there are quite a few codepaths there for combining theme and other settings sources, it's faster to ask...)

Is editing the file as suggested
a) the preferred way to do this (c.f. the org.gsd.xsettings.overrides gsettings key)
b) the only way to do this (i.e. gsettings isn't supported for this property)
c) is it expected that either this way, or the gsettings way will cause the application to be updated at runtime?
Comment 5 Matthias Clasen 2012-06-11 15:25:32 UTC
(In reply to comment #4)

> Is editing the file as suggested
> a) the preferred way to do this (c.f. the org.gsd.xsettings.overrides gsettings
> key)
> b) the only way to do this (i.e. gsettings isn't supported for this property)
> c) is it expected that either this way, or the gsettings way will cause the
> application to be updated at runtime?

The gtk-application-prefer-dark theme setting is really meant for applications to set it to opt into dark themes. That is why there is no xsetting/gsetting backing this gtk setting.

Consequently, changing the default value in the .ini file is the only way to tweak this globally, and changing the .ini file does not affect running apps.

I think this is probably good enough.

If we want to make this apply immediately, we have to add a gsetting/xsetting combination to back it, but that would go somewhat against this being a per-application setting.
Comment 6 Cosimo Cecchi 2012-07-03 02:04:43 UTC
Created attachment 217897 [details] [review]
Add a switch to globally enable the dark theme preference

Quick patch that enables this by writing the setting in the user's settings.ini file for gtk
Comment 7 John Stowers 2012-07-03 05:38:21 UTC
(In reply to comment #6)
> Created an attachment (id=217897) [details] [review]
> Add a switch to globally enable the dark theme preference
> 
> Quick patch that enables this by writing the setting in the user's settings.ini
> file for gtk

Thanks. If you have time to finish this based on my comments that would be great, otherwise I will get to it sometime next week.

1) I'd like all the logic for handling the gtksettings key file in its own class in its own file. In future I might support writing other keys for other tweaks and I don't want them to step on each other.
2) somthing like
class GtkSettingsManager:
    def set_integer()
       pass

just implement the methods you need
4) I'd probbably make GtkSettingsManager a singleton (see utils.py decorator)
Comment 8 Cosimo Cecchi 2012-07-03 16:12:03 UTC
Created attachment 217942 [details] [review]
Add a switch to globally enable the dark theme preference

New patch modified according to the review
Comment 9 John Stowers 2012-07-03 16:19:23 UTC
Attachment 217942 [details] pushed as ece8c94 - Add a switch to globally enable the dark theme preference