Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use both GNOME and KDE SC. In GNOME, I use Docky but I do not use it with KDE. So, I would like Docky to start up only when I login into GNOME not KDE. In KDE, there is an option to make a program autostart only in KDE. But I cannot find any such option in GNOME.

How can I do this?

Thanks in advance.

share|improve this question

4 Answers 4

up vote 11 down vote accepted

You can edit the startup object in ~/.config/autostart and add this to the end:

OnlyShowIn=GNOME

It's a poorly named option, but it will cause KDE not to start the application.

share|improve this answer

I don't have kde installed to verify this but I believe adding the application here: System -> Preferences -> Sessions -> Startup Programs is gnome specific.

If that doesn't work you can always put the program in a wrapper script that checks the value of the environment variable $DESKTOP_SESSION. Something like this:

#!/bin/bash
if [ $DESKTOP_SESSION == "GNOME" ];then
        myApplication
fi

Hope this answers your question!

share|improve this answer
    
System -> Preferences -> Sessions -> Startup Programs is not gnome specific. –  ricky Aug 5 '10 at 17:08

System > Preferences > Startup Applications This is the Gnome alternative to the KDE Startup Manager.

share|improve this answer
    
What Marco said, it is DM specific I think. –  invert Aug 5 '10 at 12:57
    
Thanks for the confirmation KeyboardMonkey –  Marco Ceppi Aug 5 '10 at 13:05
    
Yes but it is not restricted to GNOME only. Applications in there also starts up in KDE. –  ricky Aug 5 '10 at 17:09

If you cannot find the entry that starts a program, you might also find it in /etc/xdg/autostart instead. I know they finally fixed Nautilus automatically starting in KDE using the OnlyShownIn setting. Changing files in this directory is system wide, so you may want to copy the file of the offending application to ~/.config/autostart/

Instead of using OnlyShownIn, you can also us NotShownIn. This can allow you to not something for the one desktop, but show it for all others. For this example, you can load Docky in all desktop managers except KDE, by using the following:

NotShownIn=KDE;

If you don't want it to start on any desktop, you can change it to OnlyShownIn=; Lines in .desktop files are supposed to end with a semicolon. The semicolon is also used to separate values for settings that take more than one value at the same time.

This trick would mean that you have to list every desktop shell you use to keep something from running at all. So using NotShownIn=Unity would be fine if you only have Unity installed, but it would still start if you later installed KDE or Gnome.

If the desktop file in your user autostart folder does not stop an application from starting, you will need to deal with the desktop file in the xdg directory. For this, I would make a backup copy of the file. Instead of copying it with a bak extension, or something standard that may get overwritten later do this for the imaginary application called badapp for this example.

sudo cp /etc/xdg/autostart/badapp.desktop /etc/xdg/autostart/badapp.desktop.stop

You may then edit the original desktop file. If something breaks and you end up starting in a text boot, you can then rename the file back to the original name.

sudo cp /etc/xdg/autostart/badapp.desktop.stop /etc/xdg/autostart/badapp.desktop

Also, the default user autostart folder for KDE is ~/.kde/Autostart/ because KDE does things the KDE way.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.