Change GTK+3 look on Windows
GIMP uses GTK+-2.x. GTK+-2.x theming is complicated and strange.
GTK+-3.0 uses Adwaita theme on all platforms.
You can install a different GTK+-3.x theme.
You can change current GTK+-3.x theme by editing settings.ini
, located (when using current glib) in
- DLL prefix/share/gtk-3.0/settings.ini
- DLL prefix/etc/gtk-3.0/settings.ini
- C:/Documents and Settings/All Users/Application Data/gtk-3.0/settings.ini
- C:/Documents and Settings/username/Local Settings/Application Data/gtk-3.0/settings.ini
and adding gtk-theme-name=yourthemename
to the [Settings]
section.
(settings.ini
is also good for all kinds of other settings, look it up!)
GTK+-3.x themes are written in CSS.
As for theme installation, this is what GTK+-3.22 documentation says:
In addition, certain files will be read when GTK+ is initialized. First, the file
$XDG_CONFIG_HOME/gtk-3.0/gtk.css
is loaded if it exists. Then, GTK+ loads the first existing file amongXDG_DATA_HOME/themes/theme-name/gtk-VERSION/gtk.css
,$HOME/.themes/theme-name/gtk-VERSION/gtk.css
,$XDG_DATA_DIRS/themes/theme-name/gtk-VERSION/gtk.css
andDATADIR/share/themes/THEME/gtk-VERSION/gtk.css
, whereTHEME
is the name of the current theme (see the #GtkSettings:gtk-theme-name setting),DATADIR
is the prefix configured when GTK+ was compiled (unless overridden by theGTK_DATA_PREFIX
environment variable), andVERSION
is the GTK+ version number. If no file is found for the current version, GTK+ tries older versions all the way back to 3.0.
On Windows, with current glib, this would translate to (taking into account that 3.0
here means starting with 3.x and counting all the way down to 3.0
):
- C:/Documents and Settings/username/Local Settings/Application Data/gtk-3.0/gtk.css
Note the lack of themes
and themename
anywhere in this path.
- C:/Documents and Settings/username/Local Settings/Application Data/themes/themename/gtk-3.0/gtk.css /gtk.css
- C:/Documents and Settings/username/.themes/themename/gtk-3.0/gtk.css
- C:/Documents and Settings/All Users/Application Data/themes/themename/gtk-3.0/gtk.css
- C:/Documents and Settings/All Users/Documents/themes/themename/gtk-3.0/gtk.css
- DLL prefix/share/themes/themename/gtk-3.0/gtk.css
- exe prefix/share/themes/themename/gtk-3.0/gtk.css
You might also provide gtk-dark.css
for the dark
variant of the theme.
The default Adwaita theme is baked into GTK+ library, so you won't find Adwaita theme css files in any of the directories listed above. If you want to look at the CSS code for Adwaita, you'll have to download GTK+ source code - the theme will be in gtk/theme/
subdirectory.
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
I developed a GTK3 application on stock Ubuntu 14.04, and ported it over to Windows without any major issues.However the look of the application on Ubuntu is completely different from Windows (Much uglier on Windows). However GIMP which also uses GTK has a consistent look on Windows and Ubuntu.
I am not too familiar with how Ubuntu changes the look of GTK application, I am wondering what do I need to do for the GTK application on Windows to make it look like the one on Ubuntu?
-
John Y over 5 yearsYou mention that "GTK+-2.x theming is complicated and strange." Well, be that as it may, do you know of any tutorials or other resources for futzing with it in Windows? I'm trying to adjust the colors of the Geany UI (so that a dark-themed editor pane is less pointless), and it's a GTK2 application.
-
LRN over 5 yearsNo, i do not. AFAIU, GTK2 uses theme engines (real C code that draws widgets). I would advise to look at the windows theme engine in
modules/engines/ms-windows
subdirectory of the GTK+-2.x source tree. All of this was before my time though, so i'm afraid i don't know anything else about theme engines.