dodle
April 15th, 2010, 07:47 AM
I'm trying to write a script that will find out which desktop is being used and launch the corresponding "gksu" or "kdesu". According to what I have been able to find, i can use $DESKTOP_SESSION, but this variable is set by GDM. So if someone logs in without using GDM then it won't work.
Is there an environment variable that is specific to each desktop? That way I can do something like this:
#! /bin/bash
if [ -n "${KDE_VARIABLE+x}" ]; then
echo The current session is KDE
elif [ -n "${GNOME_VARIABLE+x}" ]; then
echo The current session is Gnome
elif [ -n "${XFCE_VARIABLE+x}" ]; then
echo The current session is XFCE
fi
Also: I've heard people talking about a command "xdg-su" that is supposed to replace "kdesu" and "gksu", but it isn't installed on my system and does not seem to be included with xdg-utils.
Edit: Or is it a better idea to run through the processes and find desktop specific processes like "gnome-session" and "kde-session"? I don't know how to do this yet, so any advice is welcome. Also, what would a process look like for other DEs like XFCE, "xfce-session"?
Is there an environment variable that is specific to each desktop? That way I can do something like this:
#! /bin/bash
if [ -n "${KDE_VARIABLE+x}" ]; then
echo The current session is KDE
elif [ -n "${GNOME_VARIABLE+x}" ]; then
echo The current session is Gnome
elif [ -n "${XFCE_VARIABLE+x}" ]; then
echo The current session is XFCE
fi
Also: I've heard people talking about a command "xdg-su" that is supposed to replace "kdesu" and "gksu", but it isn't installed on my system and does not seem to be included with xdg-utils.
Edit: Or is it a better idea to run through the processes and find desktop specific processes like "gnome-session" and "kde-session"? I don't know how to do this yet, so any advice is welcome. Also, what would a process look like for other DEs like XFCE, "xfce-session"?