Detecting the desktop environment (gnome, kde, ...)

Playing around with Ubuntu and Kubuntu, I noticed that there are far to many cosmetic differences between the two. Things which look fine in Ubuntu, are clipped in Kubuntu, etc... I was wondering what kind of solutions people use here on the list to know which DE is being used and if possible post some code.

Stani

Stani's Python Editor wrote:

Playing around with Ubuntu and Kubuntu, I noticed that there are far to many cosmetic differences between the two. Things which look fine in Ubuntu, are clipped in Kubuntu, etc... I was wondering what kind of solutions people use here on the list to know which DE is being used and if possible post some code.

It's probably not the DE, so much as the theme. On any *nix system, wx is using wxGTK, which will pick up the default GTK theme. As there are a lot of themes out there, it's probably best not to try to detect which DE you have, and hope that the theme is use is the default one for that system.

I'm guessing that Kubuntu is using a gtk theme that "looks like QT" while Ubuntu is using something they like for GNOME.

Anyway, the promise of sizers and themes is that you should have to worry about any of that!. Particularly things getting clipped. If something is getting clipped there is a bug in:

a) your sizer code
b) the wx sizer code
c) wxGTK
d) GTK
e) the GTK theme in use.

That's quite a cascade! Ideally you'd be able to figure out where the bug is, and report it appropriately.

That could be a lot of work (and take a while for the bug to get resolved and the fix work its way to people's desktops), so in the meantime maybe you can detect the theme, and have ugly hacks to work with the most common ones.

Darn, what a pain!

-Chris

ยทยทยท

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Christopher Barker wrote:

Stani's Python Editor wrote:

Playing around with Ubuntu and Kubuntu, I noticed that there are far to many cosmetic differences between the two. Things which look fine in Ubuntu, are clipped in Kubuntu, etc... I was wondering what kind of solutions people use here on the list to know which DE is being used and if possible post some code.

It's probably not the DE, so much as the theme. On any *nix system, wx is using wxGTK, which will pick up the default GTK theme. As there are a lot of themes out there, it's probably best not to try to detect which DE you have, and hope that the theme is use is the default one for that system.

I'm guessing that Kubuntu is using a gtk theme that "looks like QT" while Ubuntu is using something they like for GNOME.

Anyway, the promise of sizers and themes is that you should have to worry about any of that!. Particularly things getting clipped. If something is getting clipped there is a bug in:

a) your sizer code
b) the wx sizer code
c) wxGTK
d) GTK
e) the GTK theme in use.

That's quite a cascade! Ideally you'd be able to figure out where the bug is, and report it appropriately.

That could be a lot of work (and take a while for the bug to get resolved and the fix work its way to people's desktops), so in the meantime maybe you can detect the theme, and have ugly hacks to work with the most common ones.

Darn, what a pain!

-Chris

Well for SPE it goes further, as I need to know the default web browser (Firefox/Konqueror), terminal (gnome-terminal,konsole), ... But of course somebody can work in Gnome and prefer konsole or another bash, etc... but he can customize his settings in the preferences. However it would have been nice to have a "default" option. Anyway, it looks like it is out of scope of this list.
Stani