On 10/05/2011 10:01 AM, Didier Roche wrote:
Le 05/10/2011 15:50, Jeff Lane a écrit :
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.

Interesting question! There is nothing "official" right now, but only 3D
has the Debug method right now, so you can base on that:
com.canonical.Unity,
/com/canonical/Unity/Debug
use the interface com.canonical.Unity.Debug.Introspection and GetState()
method.
You should open a wishlist so that we can add a common dbus method
returning 2D or 3D (and raise it at UDS if possible) so that it's on the
list.

For ubuntu only from Oneiric, you can rely on the DESKTOP_SESSION
environment variable being "ubuntu" for unity 3D and "ubuntu-2d" for
unity 2D. (the detection is done before choosing the session). That
won't tell you if the ui crashed at startup though.

Didier


Awesome, thanks! I'll look at incorporating this and definitely open a wishlist bug.

--
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

--
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss

Reply via email to