I am porting some Qt Windows / VC ++ code to Linux / GCC. An application can add its own shortcut to the Windows Autostart folder so that the application starts after logging in.
I want to do the same in Linux. I use Kubuntu 15.10, but the solution should work for almost all (or at least most) Linux variants. And it should work without superuser rights (or it should request rights automatically).
I searched the Internet and found two solutions:
- Add a desktop recording file to
$HOME/.config/autostart - Add a symlink to
/etc/init.d/
Will they work on all Linux distributions? What are the differences? Which one is preferable?
Also, I would like to know if I should do this by programmatically running a shell command or if there is some native API that I could use in C / C ++ (including easy error detection).
source
share