The Startup Applications
function can be a challenge. The environment doesn't allow simple multiple commands like a delay and there's no way to order things if need be. The same exact commands that run fine in a terminal may fail to run in Startup Applications for many reasons.
My solution is simple. Make a customized bash script and add it to Startup Applications then simply edit that bash script as needed. Here's how...
Create ~/bin/startup.sh, make it executable and open it for editing
I'll do the terminal version then use pluma but you can always do this your way.
In a terminal:
mkdir ~/bin
touch ~/bin/startup.sh
chmod +x ~/bin/startup.sh
pluma ~/bin/startup.sh
Add your commands.
Here's an example file with "#" comments.
#!/bin/bash
# Delay 1 second
sleep 1
# Play the Ubuntu login sound
/usr/bin/paplay --volume=50000 /usr/share/sounds/ubuntu/stereo/desktop-login.ogg &
# Delay 2 seconds
sleep 2
# Start Conky using my custom config file
/usr/bin/conky -c /home/bill/.conky/conkymain &
-
Be sure and include the
#!/bin/bash
on the first line so it runs in a bash shell to help ensure it works same as a terminal. -
Notice how the commands end with a "&". If not included, the script will run the command then wait for it to exit. This isn't good for many things and will effectively hold this script hostage for the entire session. Adding the "&" runs the command in the background then goes on - exactly what you usually want.
-
The sleep commands do NOT get the "&" which is important if you want the delay to actually work.
-
I'm an old purist so I do all paths explicitly. It probably isn't needed but I like it that way.
Save when you're done.
Test it out.
Did you wonder why I put this file in ~/bin? It turns out this old convention for user programs remains alive and well in Mate. When you login, this directory (if it exists) is added to $PATH so you can just type the command name.
If ~/bin is new you may have to logout/login for it to be added to $PATH.
In a terminal, simply enter startup.sh
and the file will run. Results vary with what gets started by the script.
Do all the delays seem appropriate?
Did it return as expected to the terminal prompt when it completed? This is a good check you have all the "&" properly in place.
Add the script to Startup Applications.
Pretty straight forward. I title mine AAA-Startup so it's alphabetically on top.
System -> Preferences -> Personal -> Startup Applications
Click Add.
From now on, tweak your ~/bin/startup.sh file as you like, and with better control of things.