From 6fac1bccedf2267e3ce56cc61bf08d41bfbc7f47 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Wed, 3 Sep 2025 04:10:12 +0300 Subject: [PATCH] starttde: set XDG_CURRENT_DESKTOP unless already defined Bug: https://mirror.git.trinitydesktop.org/gitea/TDE/tdebase/issues/322 Co-authored-by: Alexander Golubev Signed-off-by: Alexander Golubev --- starttde | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/starttde b/starttde index 67f2baf78..85566e973 100755 --- a/starttde +++ b/starttde @@ -346,9 +346,27 @@ echo "[starttde] XDG_DATA_DIRS: $XDG_DATA_DIRS" 1>&2 test -n "$TDEHOME" && tdehome=$(echo "$TDEHOME" | sed "s,^~/,$HOME/,") -# Allow interested applications, such as the Plasma control wrapper, -# to know that this is a Trinity desktop and not a KDE one. +# Help non-TDE software identify the desktop environment. +# +# DESKTOP_SESSION is considered legacy but retained for backwards +# compatibility. export DESKTOP_SESSION=trinity +# XDG_CURRENT_DESKTOP is considered the correct way to identify desktop +# environments. This is the variable xdg-utils uses although xdg-utils +# does not explicitly support TDE. Acceptable desktop identifiers are found in +# Appendix B of the Desktop Menu Specification: +# https://specifications.freedesktop.org/menu-spec/latest/apb.html +# Note: The variable should be already set by most modern DMs (including TDM +# since R14.0.12), but when launching TDE manually via startx, it's unlikely to +# be defined, so set it here. Also note that the variable is allowed to contain +# multiple colon-separated identifiers. +if [ -n "$XDG_CURRENT_DESKTOP" ]; then + echo "[starttde] Setting XDG_CURRENT_DESKTOP=TDE" 1>&2 + export XDG_CURRENT_DESKTOP=TDE +elif ! is_in_path XDG_CURRENT_DESKTOP "TDE"; then + echo "[starttde] Setting XDG_CURRENT_DESKTOP=TDE:$XDG_CURRENT_DESKTOP" 1>&2 + export XDG_CURRENT_DESKTOP=TDE:$XDG_CURRENT_DESKTOP +fi # If necessary create the profile directory. if [ ! -d "$tdehome" ]; then