views:

64

answers:

1

Hi, I have a problem to detect when used in GNOME or KDE operating system that runs the application. The program I am doing QT4, and I have trouble feeling of look- in the systray, so I pass it to KDE, but which is not macro to do so. PD: I use KDE and C / C. I search in web and I see this: http://stackoverflow.com/questions/963611/creating-executable-for-windows-using-qt-program-in-linux But for KDE?

Greetings Alejandro Espinosa

+1  A: 

Qt does not provide this kind of defines based on the desktop environment. If you need to know the desktop environment at compilation time, then your best bet would be to modify your build system to pass the necessary defines to the compiler. The desktop environment can be concluded by different prerequisites such as environment variables, availability of applications, libraries or headers. The choice depends on what you're trying to do.

For instance, if you take the environment inspection route, KDE defines the KDE_FULL_SESSION variable whereas GNOME has the DESKTOP_SESSION variable set to "gnome". FYI, that's how Qt detects the DE at run time.

Jakub Wieczorek