Hi,
Is there an easy way to detect the desktop environment?
I want to launch the default calculator and the default on screen keyboard but I do not know how to check if KDE, Gnome or something else is being used.
Hi,
Is there an easy way to detect the desktop environment?
I want to launch the default calculator and the default on screen keyboard but I do not know how to check if KDE, Gnome or something else is being used.
I don't know how much help this will be to you, but I always perform the following commands from a terminal.
Qt Code:
ps -ef | grep startkde or ps -ef | grep gnome-sessionTo copy to clipboard, switch view to plain text mode
startkde (to run kde)
gnome-session (to run Gnome)
This will tell you whether kde or gnome is running. You could write code to perform this system call and then parse the return to determine the environment.
Not pretty, but it just might work.![]()
phannent (19th August 2008)
If you want to see how Qt does it, take a look at qt_init() in src/gui/kernel/qapplication_x11.cpp. Search for "X11->desktopEnvironment".
J-P Nurmi
phannent (19th August 2008)
Bookmarks