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

Jeff Lane jeffrey.lane at canonical.com
Wed Oct 5 13:50:08 UTC 2011


On 10/05/2011 02:30 AM, Didier Roche wrote:
> 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,

Is there a specific dbus method for determining 3D vs 2D?  We previously 
were simply looking for com.canonical.Unity since at that time, Unity 
only ran in 3D, with Gnome begin the fallback.  Now that we have both 3D 
and 2D, how can we make that determination.  It would be useful in 
testing to know if the installation is providing 3d or 2d by default.

Jeff

-- 
Jeff Lane - Hardware Certification Engineer and Test Tools Developer
Ubuntu Ham: W4KDH
Freenode IRC: bladernr or bladernr_
gpg: 1024D/3A14B2DD 8C88 B076 0DD7 B404 1417  C466 4ABD 3635 3A14 B2DD




More information about the Ubuntu-devel-discuss mailing list