如果我的理解是正确的,Ubuntu和变体将XDG_CONFIG_DIRS设置为
XDG_CONFIG_DIRS=/etc/xdg/xdg-$VARIANT:/etc/xdg然后,在/etc/xdg中包提供的系统范围内的默认配置可以被部分覆盖。通过像xubuntu这样的包-通过在/etc/xdg/xdg-xubuntu中安装配置文件来设置默认设置。
XDG_CONFIG_DIRS在哪里设置/扩展?
放置包含以下内容的文件的最佳位置是什么?
XDG_CONFIG_DIRS="/etc/xdg/xdg-mydefaults:$XDG_CONFIG_DIRS"一些候选人是/etc/profile.d /etc/environment.d /etc/X11/Xsession.d /etc/profile.d /etc/systemd/system.conf.d /etc/systemd/user.conf.d,但这些似乎没有一个被ubuntu和变体用来做这件事,所以哪一个是正确的选择?
发布于 2019-10-09 13:44:15
它是在/etc/X11/Xsession.d/60x11-common_xdg_path中设置的(来自包x11-common):
DEFAULT_XDG_CONFIG_DIRS='/etc/xdg'
DEFAULT_XDG_DATA_DIRS='/usr/local/share/:/usr/share/'
if [ -n "$DESKTOP_SESSION" ]; then
# readd default if was empty
if [ -z "$XDG_CONFIG_DIRS" ]; then
XDG_CONFIG_DIRS="$DEFAULT_XDG_CONFIG_DIRS"/xdg-"$DESKTOP_SESSION":"$DEFAULT_XDG_CONFIG_DIRS"
elif [ -n "${XDG_CONFIG_DIRS##*$DEFAULT_XDG_CONFIG_DIRS/xdg-$DESKTOP_SESSION*}" ]; then
XDG_CONFIG_DIRS="$DEFAULT_XDG_CONFIG_DIRS"/xdg-"$DESKTOP_SESSION":"$XDG_CONFIG_DIRS"
fi
export XDG_CONFIG_DIRS要添加我自己的dirs,我需要使用类似于/etc/X11/Xsession.d/70-local-my-xdg-path的东西
发布于 2019-10-09 13:32:49
不知道什么是“对的”,但至少/etc/profile.d对我来说很好。
$ cat /etc/profile.d/my-xdg-dir.sh
XDG_CONFIG_DIRS="/etc/xdg/xdg-mydefaults:$XDG_CONFIG_DIRS"
$ echo $XDG_CONFIG_DIRS
/etc/xdg/xdg-mydefaults:/etc/xdg/xdg-ubuntu:/etc/xdg关于设置它的位置的问题,/etc/profile.d/xdg_dirs_desktop_session.sh文件看起来很可疑。
https://askubuntu.com/questions/1179729
复制相似问题