How to delay startup applications

Hello,
I want to delay some programs on startup.
I use pretty much the default Manjaro (xfce Desktop and so on) I think this should be the only relevant information about my system.
So when I open the Settings and Navigate to:
"Session and Startbehavior" in the "System" part>
"Automatically started applications" its the second Tab
(not the original English Names cause I translated this by self cause somehow I was not able to change the language)
Then I can see all programs that are automatically started on startup and if I select Steam for instance and then click on edit a pop-up window will appear with the Name, Description, command and trigger.
To delay Steam I tried to change the command from
/usr/bin/steam %U (this was created by Steam itself)
to
sleep 30 && /usr/bin/steam %U and even sleep 30 /usr/bin/steam %U
but if I did that it didn't started at all
but if I execute sleep 30 && /usr/bin/steam %U in the terminal it works.
So what is my mistake and how can I simply delay a program start by a amount of time of my choice?
(I already checked other Topics about this but the only one that seems to be working was only for GNOME I guess)

Try this command for Steam in the Session and Startup > Application Autostart window

sh -c "sleep 30 && /usr/bin/steam %U"

and see if that works.

7 Likes

I have one little script that starts all my applications, so the only thing in my autostart is /usr/local/bin/fab_startup and then in that script you just put all the commands that you want executed during startup:

Contents of my script:

#!/bin/bash

# Play sound to notify login successful
aplay /usr/share/sounds/ST_Computer_Authorization_Accepted.wav &
# sleep 2 seconds to allow DE to use full CPU to start up after login sound
sleep 2
#Start Konsole on Desktop #1
/usr/bin/konsole &
sleep 2
# Start optimus manager tray icon
#/usr/bin/optimus-manager-qt
#sleep 2
/usr/bin/telegram-desktop &
sleep 2
filelight &
sleep 1
#/usr/bin/qbittorrent &
#sleep 1
firefox &

How to create such a script:

sudo nano /usr/local/bin/lam_startup
  • The first line must be #!/bin/bash
  • When you want the script to execute and continue, set the last character on the line to & (=start in background)
  • When you want the script to wait for a number of seconds before continuing add sleep nnn where nnn is the number of seconds.

then execute:

sudo chmod +x /usr/local/bin/lam_startup

to make it executable

Test it in a terminal and then add it to your startup programs and move everything else in your startup programs to the script: this way you have much more control of what starts first, how long until the next program starts, which parameters to use, ...

:+1:

5 Likes

I tried to several restarts of my system and some how sometimes is was not applied or Steam reseted the setting but than I disabled or unchecked the automatically created process and added a new one from scratch with your command and now it looks like it is working.
Thanks

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by