Autostarting services

One new feature in GNOME 2.13/2.14 that seems to have gone unadvertised is the support for autostarting applications. You just need to put .desktop files in $prefix/share/gnome/autostart or ~/.config/autostart and all applications there will be started by gnome-session when you log in.

Just a few things to note about this:

  • If your application has another mean to be started (an applet, a config dialog that will start the app and then save itself to the session, like vino, for instance), don’t use this!
  • It doesn’t work very well with session-managed applications (even though it contains checks to not start several instances of the same app), so make sure you use the –sm-disable argument in the Exec field of the .desktop file.
  • You can disable .desktop files either by setting X-GNOME-autostart-enabled to False in the .desktop file or by using the Session Properties capplet.

6 thoughts on “Autostarting services”

  1. Rather than passing –sm-disable in the .desktop file, why not tell gnome_program_init() not to connect to the session manager to start with?

    You just need to set the GNOME_CLIENT_PARAM_SM_CONNECT property to FALSE.

  2. I guess you still want to have session-management enabled when the application is started by other means. But yes, some apps that don’t mind about session management could do that.

  3. If you always disable the session manager then you run the risk of applications being stuffed.

    E.g. if you start gnome-power-manager with –sm-disable it can’t always signal the session for things like the logout dialog to appear when you hit the power button.

  4. Two things:

    * Why, if this is a spec, is it GNOME specific? It’d be better to not ship this feature at all than your current approach which will just result in ridiculous inconsistency and the need to check the system for bugs before using the feature. PLEASE revert this, it is NOT worth having gnome/kde specific directories for such a small feature!

    * Can you comment on my proposal to use a small program to register autostart items rather than directly modifying the relevant directories?

  5. It’s not GNOME specific, it implements the whole spec, but just deviates a bit in the directory, while supporting the same dir specified in the spec. And we are talking with the other people involved in the spec to fix a few things. So, there’s no need to revert this, it’s just a first step to implement the same spec as KDE.

    About your proposal, please raise it on the freedesktop list, so that we all can comment on it.

  6. The proposal was already raised on the list, see “Autostart and MAC security”. Waldo and Francois commented.

    OK, sorry about the directories, it sounded like you had actually changed the directory it used rather than look at a different one. As long as the interface exported to 3rd parties is the same as what the spec says, then this is OK.

Comments are closed.