1

CentOS 7.x with GNOME 3 Shell by default provides the following *.desktop files under /etc/xdg/autostart/ with AutostartCondition key:

# gnome-welcome-tour.desktop
[Desktop Entry]
Type=Application
Name=Welcome
Exec=/usr/libexec/gnome-welcome-tour
AutostartCondition=if-exists run-welcome-tour
OnlyShowIn=GNOME;
NoDisplay=true

And

# gnome-initial-setup-first-login.desktop
[Desktop Entry]
Name=Initial Setup
#...
Icon=preferences-system
Exec=/usr/libexec/gnome-initial-setup --existing-user
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;System;
OnlyShowIn=GNOME;
NoDisplay=true
AutostartCondition=unless-exists gnome-initial-setup-done
#...

My questions:

  1. Am I correct in thinking AutostartCondition key determines if the value of Exec key gets executed by GNOME 3 (or another XDG compliant desktop or session manager) after reading the /etc/xdg/autostart/*.desktop file on startup?
  2. How do I query the current value for AutostartCondition?

In relation to question #2: I've attempted the following unsuccessfully (I've already completed both gnome-welcome-tour and gnome-initial-setup and am not prompted on login):

[user@user-centos-7 ~]$ gconftool-2 --recursive-list / | grep gnome-initial-setup-done
[user@user-centos-7 ~]$ gsettings list-schemas | while read -r SCHEMA; do gsettings list-recursively $SCHEMA; done | grep gnome-initial-setup-done
[user@user-centos-7 ~]$ 
[user@user-centos-7 ~]$ gconftool-2 --recursive-list / | grep run-welcome-tour
[user@user-centos-7 ~]$ gsettings list-schemas | while read -r SCHEMA; do gsettings list-recursively $SCHEMA; done | grep run-welcome-tour
[user@user-centos-7 ~]$ 

Thanks.

1

The session manager reads the .desktop files of all the start-up apps. If if finds an AutostartCondition key in any of those files, it checks its value: if the condition is not met, that particular app is removed from the list of start-up apps. The autostart conditions are described in a very old post on freedesktop mailing list:

The Autostart-Condition Key

The Autostart-Condition key gives a condition which should be tested before
autostarting the application; if the condition is not met, then the application
MUST NOT be autostarted. The condition can be in one of the following forms:

    if-exists FILE

        The application should only be autostarted if FILE exists
        (relative to $XDG_CONFIG_HOME).

    unless-exists FILE

        The application should only be autostarted if FILE *doesn't* exist
        (relative to $XDG_CONFIG_HOME).

    DESKTOP-ENVIRONMENT-NAME [DESKTOP-SPECIFIC-TEST]

        The application should only be autostarted under the named desktop environment
        (as with OnlyShowIn). If DESKTOP-SPECIFIC-TEST is also given, the desktop
        environment will evaluate it in some manner specific to that desktop to
        determine whether or not the application should be autostarted.


which would end up being used like:

Name=kgpg
# start only under KDE, and only if the given kconfig key is set
Autostart-Condition=KDE kgpgrc:User Interface:AutoStart:false

Name=vino
# start only under GNOME, and only if the given gconf key is set
Autostart-Condition=GNOME /desktop/gnome/remote_access/enabled

Name=beagled
# start under any desktop environment, unless
# ~/.config/beagle/disable-autostart exists
Autostart-Condition=unless-exists beagle/disable-autostart

So, in your particular case, the autostart condition is that ./config/run-welcome-tour exists and respectively that ./config/gnome-initial-setup-done doesn't exist.

  • Thanks @don_crissti. So the session manager looks up flat files under ~/.config/ on the filesystem and not key=value pairs in GConf DB/registry. – gearge Dec 29 '18 at 4:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.