autostart-scripts 目录的用途

pal*_*wim 9 scripting login freedesktop gnome3

用户可以将.desktop文件放入其~/.config/autostart/目录中,以便在 Gnome或任何与 Freedesktop 兼容的环境中登录(会话启动)时运行脚本

但是,在我的 openSUSE Leap 42.2 Gnome 3 系统上,除了每个用户的~/.config/autostart/目录之外,每个用户还有一个~/.config/autostart-scripts/目录。我假设该目录将充当用户希望在登录时运行的任何快速而肮脏的脚本的垃圾场,而不必将这些脚本包装在文件中.desktop,但我放置在该目录中的脚本不会在登录时运行。

搜索引擎几乎没有提供有关该目录的详细信息。有谁知道该目录的用途~/.config/autostart-scripts以及其中脚本运行的要求?

pal*_*wim 3

因为(正如用户 Villapx 所发现的KDE Plasma 5autostart-scripts在其源代码中具有此目录,所以我假设它是 Plasma 5 的一项未记录的功能,并且我曾经在 KDE 下运行此配置文件。

我能够针对其他桌面环境调整我的系统,使其正常工作,因为我相信 KDE 使用它。为此,我在以下位置添加了一个系统自动启动桌面文件/etc/xdg/autostart/exec-autostart

[Desktop Entry]
Exec=autostart-exec.sh
Icon=system-run
NotShowIn=KDE
Terminal=false
TerminalOptions=
Type=Application
Run Code Online (Sandbox Code Playgroud)

这引用了一个脚本,该脚本将调用目录中的每个脚本(使用自动启动规范autostart-scripts中的目录确定):

#!/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
Run Code Online (Sandbox Code Playgroud)