Search code examples
cx11xlibvalafreedesktop.org

Query XSettings Manager for Icon Theme


I'm writing an Application in Vala (a c compatible language) for which I need the icon theme that is currently set.
I want to avoid having GTK+ or Qt as an dependency.

I know that GTK+ 3 has a settings.ini and GTK+ 2 has a .gtkrc-2.0 file, but according to this those files are only fallbacks in case no XSettings Manager is running.

I tried to find some informations about XSettings Manager and it seems that XSettings is only a specification that gets implemented by desktop environments. The most popular implementation is probably Gnomes gnome-settings-daemon but there are others like lxsettings-daemon (integrated in lxsession) in LXDE or xfsettingsd of XFCE.

Now I need to find out how to query the XSettings Manager for the value of the Net/IconThemeName key.

I found this specification, but I dont quite understand it. (I have never worked with Xlib before)
Is this what i need ?


To be clear: I don't want to implement the XSettings Manager spec, but I want to query the currently running implementation for the currently set icon theme.

Can somebody please help me understand the spec? It seems rather confusing to me.

Or am I doing it completely wrong ?


Solution

  • There's a library called libxsettings-client that provides a C interface for accessing XSettings. You'd need to port the API to Vala, which looks pretty straight forward given how small it is (<70 lines). It would depend on x11.vapi, which is already included with Vala. Have a look at binding legacy APIs for information on how to port it.