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?
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
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
):
Note the lack of themes
and themename
anywhere in this path.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With