The Autostart Dir
From:     https://unix.stackexchange.com/questions/348321/purpose-of-the-autostart-scripts-directory






Purpose of the autostart-scripts directory 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?
  1. 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, 2019 at 21:29
  2. 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, 2019 at 21:40
    Answer 1 Because (as user villapx discovered) KDE Plasma 5 has this autostart-scripts directory in its source, I am assuming that it is an undocumented feature of Plasma 5 and that I was running this profile under KDE at one point. I was able to tweak my system for other Desktop Environments to make it work as I believe KDE uses it. To do this, I added a system autostart Desktop file at /etc/xdg/autostart/exec-autostart: [Desktop Entry] Exec=autostart-exec.sh Icon=system-run NotShowIn=KDE 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
    Answer 2 I'm adding some extra information here for general googlers on this dir.. It seems KDE changed the workings of this dir in 2021 (without telling people widely, much to the ire of some), and "unilaterally" moved this dir to 'old -autostart-scripts'. Then a .desktop file was created in /home/user/.config/autostarts dir for each script." Currently the scripts inside of $XDG_CONFIG_HOME/autostart-scripts are not run in systemd mode (https://bugs.kde.org/show_bug.cgi?id=433987). This PR migrates them to simple .desktop files inside of XDG_CONFIG_HOME/autostart so that they can be handled in both classic and systemd boot mode. This way they can also be seen by other desktop environments (autostart-scripts was a kde-only feature). And you can even define login scripts at the system level thanks to the xdg config hierarchy The migration will create a corresponding .desktop file for each existing login script. If the login script was a symlink, it will be deleted and the .desktop file will point to the source. The KCM is also updated to use this new format. Login scripts are still visible as such (using a kde service type to distinguish them). Instead of creating a symlink to $XDG_CONFIG_HOME/autostart-scripts, adding a new script now creates a .desktop file in $XDG_CONFIG_HOME/autostart This also separates pre-startup (env) scripts from login scripts in the UI. They were previously supported but merged in the same category. It seems to be automatically moving files still in 2023.