4

A user can place .desktop files in his ~/.config/autostart/ directory to run a script on login (session start) in Gnome, or indeed any Freedesktop-compliant environment.

But, on my openSUSE Leap 42.2 Gnome 3 system, in addition to each user's ~/.config/autostart/ directory, each user also has a ~/.config/autostart-scripts/ directory. I would assume that this directory would serve as a dumping ground for any quick and dirty scripts that a user would want to run on login without having to wrap those scripts in a .desktop file, but the scripts I place in that directory do not run on login.

Search engines have provided very little in the way of details about this directory. Does anyone know the purpose of the ~/.config/autostart-scripts directory and the requirements for the scripts in it to run?

  • Glad that I'm not the only one wondering about this cryptic directory. Obviously your synopsis per the Freedesktop spec for the autostart directory is straight from the Freedesktop docs; and as for autostart-scripts, KDE Plasma 5 behaves exactly as you assume: it executes any executables in that directory. Not knowing much about GNOME 3, I don't know why it didn't "work" (what does "work" really even mean here?) for you there, but Plasma 5 observes that behavior. – villapx Jan 7 at 21:29
  • Indeed, Plasma 5 has autostart-scripts hardcoded in its source (along with plasma-workspace/shutdown and plasma-workspace/env): here it is on GitHub. Googling this directory name yields absolutely nothing, though, so it's not part of any standard. I assume the KDE folks just chose it kind of arbitrarily – villapx Jan 7 at 21:40
0

I never determined the actual purpose for this directory's existence, but I did tweak my system to make it work as I would expect it to work.

I added a system autostart Desktop file at /etc/xdg/autostart/exec-autostart:

[Desktop Entry]
Exec=autostart-exec.sh
Icon=system-run
# NotShowIn=GNOME # Run in all X environments
Terminal=false
TerminalOptions=
Type=Application

This referenced a script that would call each script in the autostart-scripts directory (using the directory determination from the Autostart spec):

#!/bin/sh

shopt -s nullglob # Ensure shell expansion with 0 files expands to an empty list, rather than trying to read the "*.sh" file

if [ -z "$XDG_CONFIG_HOME" ]; then
    XDG_CONFIG_HOME=~/.config
fi
for f in "$XDG_CONFIG_HOME/autostart-scripts/"*.sh; do
    test -x "$f" && . "$f" || true
done

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.