45

How to delay a program such as cairo-dock (No openGL) or Firefox?

Sometimes programs crash when started with other startup apps. I want programs to start 10 seconds late to avoid a crash.

53

Delaying autostart with inbuilt delay option


Note: Only works with desktop sessions that recognize the X-GNOME-Autostart-Delayparameter (e.g. Unity, Unity2D, GNOME). This will not work for LXDE, XFCE, KDE, etc.


With this solution there's no need for a script or sleep. Head to your autostart folder:

nautilus ~/.config/autostart

Find the .desktop file that corresponds with your application and open it in a text editor, e.g. gedit:

gedit ~/.config/autostart/application.desktop

Append the following line to the file:

X-GNOME-Autostart-Delay=foo

where foo is the time in seconds you want to delay the application launch by, e.g.:

X-GNOME-Autostart-Delay=60

Save the file, relog and you should see the effects.

| improve this answer | |
  • This works very well in both ubuntu 12.04 and in 12.10-development release using Gnome-shell 3.6 – bmbaker Oct 7 '12 at 18:01
  • 2
    Works in Ubuntu 18.04. – Ives Jul 3 '18 at 13:50
  • Is there a website or man page to find documentation for GNOME parameters? I searched in gnome-session man page but could not find them. – sergio May 25 at 17:15
23

Try this:

bash -c "sleep 10 && firefox"
| improve this answer | |
  • 3
    10x a lot, why does just sleep 10 && firefox not work? – user3804598 Jan 2 '18 at 20:43
6

You could try to change the command to this:

sleep 10 && firefox

Some people say it works, some say it doesn't, if this is your case, and it does not work, you can try with:

xterm -e 'sleep 10 && firefox'
| improve this answer | |
5

I had to use this to get it to work for skype: sh -c "sleep 10 && skype &" in Ubuntu 12.04

| improve this answer | |
1

Solution by @Noraj works well for Ubuntu 18.04. Adding a couple of practical examples for Google Drive sync via Insync, and Synology cloud-drive. I don't want them to delay the startup.

For google-drive:

[Desktop Entry]
Version=1.0
Type=Application
Name=Insync
GenericName=Insync
Comment=Launch Insync
Icon=insync
Categories=Network;
Exec=insync start
TryExec=insync
Terminal=false
X-GNOME-Autostart-Delay=60

And for cloud-drive:

[Desktop Entry]
Name=Synology Drive Client
Comment=Synology Drive Client
Exec=synology-drive autostart
Icon=/opt/Synology/SynologyDrive/images/ico_72_cloud_station.png
Terminal=false
Type=Application
Categories=Network;FileTransfer;
X-GNOME-Autostart-Delay=75

Both files locate at $HOME/.config/autostart if you installed the applications and chose to make them start at login.

| improve this answer | |
0

Make a startup command using https://askubuntu.com/a/48327/139749 . Then you can add delay by opening ~/.config/autostart and edit related file. You should add the following commands:

X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=10
| improve this answer | |
  • you're repeating the first answer. – maxadamo Dec 31 '19 at 11:24

Your Answer

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