How to determine unity or gnome-shell or something else is running in C

Didier Roche didrocks at ubuntu.com
Wed Oct 5 06:30:33 UTC 2011


Le 05/10/2011 08:17, YunQiang Su a écrit :
>   I am trying to make a program has different tray in different environment:
>     when indicator is supported, indicator plug-in is used,
>     when in gnome-shell or gnome-panel, notification area written by  gtk
>     when KDE, use the way KDE prefer,
>
>   Then the problem is that how I can determine which are using dynamic?
>   unity, gnome-shell or something else ?
>
>
You can detect Unity using dbus. There is a Bus Name 
com.canonical.Unity.Launcher which is there only when Unity is running. 
This method is 100% reliable compared to session name 
(DESKTOP_SESSION=ubuntu, DESKTOP_SESSION=ubuntu-2d…) which isn't cross 
distribution.

For other like gnome-shell, I'm not sure if something similar exists.

Didier




More information about the Ubuntu-devel-discuss mailing list