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 want to make Cairo dock(with opengl) execute in the start-up only on Gnome-Classic but not on other DEs like cinnamon, unity or gnome.How to do that?

share|improve this question

2 Answers 2

up vote 6 down vote accepted
  1. First create a script which will run cairo-dock based on $DESKTOP-SESSION environment variable. We are going to create the script in ~/.config/autostart directory and naming it cairo.sh

    • Press Ctrl+H to let nautilus show hidden file. Then Go to your home directory → .configautostart directory.

    • Right Click on the empty space in nautilus. Select Create new documentEmpty Document. Name this file cairo.sh.

    • Double click on the newly created file to open it in gedit text editor (or any other editors of your choice) and paste these lines in it.

      if [ "$DESKTOP_SESSION" = "gnome-classic" ]; then
          cairo-dock
      fi
      
    • Then close the file. Right Click on it, Select Properties.

    • On the Properties windows, in Permissions tab, Check Allow executing file as a program.
  2. Then create another file in the same directory, i.e ~/.config/autostart with name cairo. (Don't first name it with .desktop extensions for avoiding later hussle opening it)

    In that file, copy these lines and paste there, changing the appropriate information like inputting the name of the user in place of "name of user". It is an .desktop file which will be called on startup

    [Desktop Entry]
    Type=Application
    Exec=/home/<name of user>/.config/autostart/cairo.sh
    Hidden=false
    NoDisplay=false
    X-GNOME-Autostart-enabled=true
    Name[en]=Cairo
    

    Save the file and exit gedit.

  3. Then rename the file adding extension .desktop. To rename, Select the file and Press F2.

  4. After renaming it, Again make the file executable. To do so, Select the file → Select Properties. And in the new window, in Permissions tab, select the checkbox saying Allow the file to run as a program.

  5. Logout and Login to gnome-classic session. Cairo-dock will be started automatically.

If you want to run Cairo on another desktop environment as well, such as ubuntu, you just need to repeat this process, making another set of commands just for that desktop session. First you would make another cairo.sh, naming it slightly different, such as cairo2.sh. Then you would open it with nautilus and copy the following lines:

        if [ "$DESKTOP_SESSION" = "ubuntu" ]; then
            cairo-dock
        fi

Then you would save the file and make it executable as before.

Next, you would once again create a .desktop command, also naming it slightly different, such as cairo2. When copying the command lines, copy the following:

    [Desktop Entry]
    Type=Application
    Exec=/home/<name of user>/.config/autostart/cairo2.sh
    Hidden=false
    NoDisplay=false
    X-GNOME-Autostart-enabled=true
    Name[en]=Cairo

Don't forget to input the user name in place of "name of user" and to make sure the name of the file on the Exec= line is the same as your .sh command for ubuntu, in this case cairo2.sh.

After this just follow the steps as before and when you log in to the appropriate desktop environment, cairo dock should open atuomatically.

share|improve this answer

Have a look at the files in /usr/share/xsessions/.

There you'll find ubuntu.desktop, ubuntu-2d.desktop (if you're not on 12.10 already) and gnome-fallback.desktop (maybe also gnome-classic.desktop. I have gnome-shell installed maybe that's where this is from).

Open one of those and you'll see they all have an Exec=gnome-session --session=... line. For gnome-fallback open /usr/share/gnome-session/sessions/gnome-fallback.session.

Now you can

  1. change in /usr/share/gnome-session/sessions/gnome-fallback.session the line

    RequiredComponents=gnome-panel;gnome-settings-daemon;

    to

    RequiredComponents=gnome-panel;gnome-settings-daemon;cairo-dock; (check the executable name!)

  2. change in /usr/share/xsessions/gnome-fallback.desktop the Exec= line, for example

    Exec=/home/<yourname>/<yourexecbashscript>

    or also copy your current autostart folder .config/autostart/ to a new place

    Exec=gnome-session --session=gnome-fallback -a <Newplaceofautostartfolder>

  3. create a all new session. copy and rename both gnome-fallback.session and gnome-fallback.session to their new to their respective places under a new name and adjust your new session like in 1.

The first two of those work but have the disadvantage that they may or may not be overwritten on update (you will have to check, I'm not sure).

In 2. Also if you copy your autostart folder only one of those will be updated depending on which session you are logged into.

So I recommend doing it as shown in 3. Have fun.

share|improve this answer
    
+1. Your answer was helpful. :) –  Anwar Shah Sep 9 '12 at 17:52

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.