The best i could come up with was to search the environment variables 'env' for the global $DESKTOP_SESSION which gives a nice answer if you are running as guest. If you are running as root (which alot of apps require) then $DESKTOP_SESSION gives you nothing. I feel the best way would be to check out the running process and through a process of elimination, work out what desktop your are using.
Anybody have some ideas? Keep in mind a user could have LXDE and KDE moduels loaded, but only using one desktop. They could also be logging out and switching to another desktop. The ideal solution would cover all scenarios.
Posted after 48 minutes 52 seconds:
Ok after busting my nut for a while here is what i came up with.
Code: Select all
# Get dekstop session [ `pidof ksmserver` -a "`uname -m|grep i*86`" ] && dsession=kde3 [ `pidof ksmserver` -a "`uname -m|grep 64`" ] && dsession=kde4 [ `pidof lxsession` ] && dsession=lxde case $dsession in kde3 ) if [ -f /usr/bin/konqueror ]; then ln -s /usr/bin/konqueror /tmp/.wmanager else if [ /usr/bin/pcmanfm ]; then ln -s /usr/bin/pcmanfm /tmp/.wmanager fi fi ;; kde4 ) ln -s /usr/bin/dolphin /tmp/.wmanager ;; lxde ) ln -s /usr/bin/pcmanfm /tmp/.wmanager ;; esac