I have a Multi-Desktop Environment with Unity and KDE. Because of reasons, I installed only the environments without the specific tools, like nautilus or dolphin.

Since the users (They are multi-user PCs) needs those tools to work, I've written a script, which installs the specific tools for the environment the user is logged in and removes the others (i.e., the user logged into KDE, the script installs dolphin and removes nautilus). This works quite well, unfortunately the users have to remember to run it.

I wanted to automate this process by adding this script to lightdm, by placing a config-file at /usr/share/lightdm/lightdm.conf.d looking like this:


and performing the check for the environment inside the called script, with:

        do stuff....

but as stated in the heading, the variable isn't set at this point.

I've also tried to add a script which only contained the installing and removing part to the /usr/share/xsessions script, but that also failed, since I didn't had root-permission at that point. And I can't change the sudoers rule to enable apt-get for non-root users, since I don't want anyone to be able to install software to those maschines.

Does anyone have a soultion for this? Or at least a good idea, how I could fix this?

  • Possibly the XDG_CURRENT_DESKTOP variable is more accurate for this purpose. Haven't checked if it's set early enough, though. – Gunnar Hjalmarsson Aug 11 '16 at 18:01
  • Thanks, unfortunately it didn't (or maybe I'm just to dumb to check it correctly). But at least I found a workaround. I made a short c-script, which calls the script to install the tools. Since this compiles into a binary I can use SUID and run the command inside as root. At least this does it's job, until I find a sane solution for this problem. – Moritz Dafelmair Aug 16 '16 at 9:06
  • Great! Another approach might be to always have both nautilus and dolphin installed, and control their visibility via the OnlyShowIn option in .desktop files. – Gunnar Hjalmarsson Aug 16 '16 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.