Skip to content

Commit 3ace70c

Browse files
committed
profile.d: enable compatibility of XDG_RUNTIME_DIR to systemd
Signed-off-by: Icenowy Zheng <[email protected]>
1 parent dbd89fd commit 3ace70c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

profile.d/40-desktopenvironments

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
[ -f /etc/locale.conf ] && . /etc/locale.conf
44
export LANG
55
if test -z "${XDG_RUNTIME_DIR}"; then
6-
export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir
7-
if ! test -d "${XDG_RUNTIME_DIR}"; then
8-
mkdir "${XDG_RUNTIME_DIR}"
9-
chmod 0700 "${XDG_RUNTIME_DIR}"
6+
if test -d "/run/user/${UID}"; then
7+
# Systemd uses this as XDG_RUNTIME_DIR
8+
export XDG_RUNTIME_DIR=/run/user/${UID}
9+
else
10+
export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir
11+
if ! test -d "${XDG_RUNTIME_DIR}"; then
12+
mkdir "${XDG_RUNTIME_DIR}"
13+
chmod 0700 "${XDG_RUNTIME_DIR}"
14+
fi
1015
fi
1116
fi
1217

0 commit comments

Comments
 (0)