GNOME Bugzilla – Bug 677803
add option to use dark theme for all windows
Last modified: 2012-07-03 16:19:26 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.
Is the recommended way to do this desktop-wide via the org.gsd.xsettings.overrides gsettings key?
I don't think there is a way to do this, currently. This would need some GTK+ changes
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
(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?
(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.
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
(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)
Created attachment 217942 [details] [review] Add a switch to globally enable the dark theme preference New patch modified according to the review
Attachment 217942 [details] pushed as ece8c94 - Add a switch to globally enable the dark theme preference