I’m trying to add custom CSS to my app. I followed what is suggested in this tutorial (adapting screen to display, because I’m using GTK4), but it does not work because the gdk_display_get_default is consistently returning NULL.
I tried to list all the displays, but I get an empty list:
The default display connection is available after the toolkit has been initialised.
The proper place to add a custom CSS provider is in GApplication::startup; you do not want to use activate, as that will be invoked every time your application gets activated—e.g. if a new instance gets launched when one is already running.