6

I use Xubuntu 16.10 and I want to run following command (this is the code for fixing dropbox icon) every time Linux session starts:

dropbox stop && env DBUS_SESSION_BUS_ADDRESS="" dropbox start -i

How can I do it?

I copied the code as a new command in session and start up -> Application autostart but it doesn't work.

Sadegh
  • 1,105

2 Answers2

12

Timing issue

I am pretty sure it is because of the timing. The command most likely runs before its target is "in the field".

Changing the command into:

/bin/bash -c "sleep 15 && dropbox stop && env DBUS_SESSION_BUS_ADDRESS="" dropbox start -i" 

...will probably do the job.

Jacob Vlijm
  • 83,767
  • Unfortunately it doesn't work. There is a question mark icon instead of dropbox icon without any pop up menu: http://i.imgur.com/UcU8y1y.png . If I run the command in terminal, then everything is fixed as expected – Sadegh Jul 07 '16 at 10:29
  • 1
    @Woeitg please try to increase the time to 45, if it works (I am pretty sure it should) , try to find the edge. – Jacob Vlijm Jul 07 '16 at 10:35
  • 1
    Jacob's code updated to new implementation: /bin/bash -c "sleep 15 && dropbox stop && dbus-launch dropbox start" – dez93_2000 Sep 07 '17 at 20:18
  • I also having an issue in my xubuntu 16.04 lts ..so I run the above command /bin/bash -c "sleep 15 && dropbox stop && env DBUS_SESSION_BUS_ADDRESS="" dropbox start -i" and it finally works. thanks! – Arman Ortega Sep 10 '17 at 12:14
0

This problem bugged me for a -long- time, but finally a fix that works for me with Xubuntu 16.04:

The normal menu launcher (which works fine) uses ~/.local/share/applications/dropbox.desktop

which contains the line:

Exec=dbus-launch dropbox start -i

The startup launcher (which has the bug) uses ~/.config/autostart/dropbox.desktop

which contains the line:

Exec=dropbox start -i

The solution:

Use the same command for session startup as the normal menu launcher. Dead easy - but just one problem:

When the dropbox app runs, it overwrites ~/.config/autostart/dropbox.desktop with the command that fails, which it copies from /usr/share/applications/dropbox.desktop. So we need to fix this file rather than the one in ~/.config/autostart/dropbox.desktop

  1. In a terminal window, run the command:

    sudo mousepad /usr/share/applications/dropbox.desktop

    (if you don't use Mousepad, substitute the command for your preferred text editor)

  2. Enter your password when prompted

  3. Replace the line:

    Exec=dropbox start -i

    with:

    # Exec=dropbox start -i Exec=dbus-launch dropbox start -i

  4. Save the file and close Mousepad.

  5. Ensure that Dropbox Preferences are set to start Dropbox on system startup.

  6. Reboot to test.