Running a Qt application at startup

2019-01-26 18:50发布

问题:

I wrote a Qt application that is going to run on Linux. It supposed to run at startup.

It's supposed to run on every Linux- Suse, RedHat etc.

What script should I write and Where to put it?

I don't know how to write scripts at all, so I would appreciate it if you will attach an example.

回答1:

You need to create a desktop entry file for your application (see here) and to put it in user's $HOME/.config/autostart directory.

Any desktop entry file in that dir will get executed when a Window Manager starts up (see here).

To do this, usually you'll need to create your desktop entry file by hand (that's it, not via C++ code/script) and to just install in that directory via C++ code.