GTK 4: set environment variable

Hi

I ported my GTK 3 program to GTK 4.
The GTK 3 program I could run in the command line by first entering an environment variable to apply a theme

set GTK_THEME=theme_folder

and then running the EXE (in the same command line window).

This doesn’t work anymore with my GTK 4 program.

Is there something else I need to do to make it work , as it used to work in GTK 3?

Nothing has changed in GTK4: there’s still the GTK_THEME environment variable. If it’s not working then it means your theme does not support GTK4, or the theme isn’t found.

If you’re setting a theme for your own application, I would recommend loading the CSS directly with a GtkCssProvider applied to the default GdkDisplay, instead of using environment variables; this way, you can ship your theme embedded into a GResource, and ensure that it is always available.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.