How to launch application on startup
Solution 1:
First: in new Ubuntu versions, the file /etc/rc.local
does not work anymore. If you want to run something at system startup, you should add it to the crontab (see man 5 crontab
) using @reboot
time specification.
Second: you cannot run a command that interacts with the desktop that way, because of two reasons: a) when the system starts, your GUI desktop is not ready yet, so there's simply no place where the application window could be displayed; b) a command that runs from crontab (or /etc/rc.local
, if it would work) does not share the environment with your desktop session, so is missing important system variables required for GUI applications to work.
The solution is to add your application to "Startup Applications" in your desktop session (there's a special tool for that) - then your application will start together with your desktop session when you log in.
Solution 2:
You should not start up an application that regularly simulates a mouse click, such as this "keep-presence" utility, using system wide installation procedures. Instead, you should enable automatic startup of these applications when the user logs in. Anyway, the program will probably fail if you decide to attempt otherwise, because it needs a graphical environment to run.
The easiest way to have an application autostart is to launch the tool "Startup applications". In the dialog, click Add and fill the fields.
That has to be done for each user account. If you rather want this to happen by default for each user account on the system, then a .desktop
launcher for this command can be moved to /etc/xdg/autostart
.
The easiest way to create such .desktop
launcher is actually to use "Startup applications". That will create such .desktop
launcher in the user's local autostart
folder, i.e., ~/.config/autostart
. Move that to the systemwide /etc/xdg/autostart
to have it in effect for all users.