4

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.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
sara
  • 3,824
  • 9
  • 43
  • 71

1 Answers1

3

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.

peoro
  • 25,562
  • 20
  • 98
  • 150
  • What path sould I specify? To which file- the pro? the exec of debug? of release? – sara Nov 11 '10 at 08:54
  • Where? Inside the desktop entry file? In that file you need to put the path to your executable. If you look in `~/.config/autostart` (or if you look in some system dirs like `/usr/share/apps/`, you'll find plenty of desktop entry files to use as example) – peoro Nov 11 '10 at 09:25
  • OK. i made the entry file and it's working. but i still have a problem: it's supposed to read settings from an ini file but when it is launching on startup it fails to load the ini file. when i activate it manuali from the autostart folder- it succeeds. why? is it possible that it is still dudn't mount the file or something like this? – sara Nov 11 '10 at 11:12
  • 1
    Where is your ini file, and how do you load it? If you use a relative path that's probably the reason: check your application's current working directory... – peoro Nov 11 '10 at 13:19
  • you are right that is the problem. but in the link u directed me to it says that what i set in entry in the path=... will be the cwd, or did i misunderstood? – sara Nov 11 '10 at 14:23