Skip to content

Commit 5960a1c

Browse files
committed
mergetool-lib: use $XDG_CURRENT_DESKTOP to check GNOME
To list merge tool candidates we used to use a private GNOME env variable (GNOME_DESKTOP_SESSION_ID) that has been deprecated for long time ago and removed as part of GNOME 3.30.0 release [1]. So, git should instead primarily check the XDG_CURRENT_DESKTOP env variable, that is now supported by all the desktop environments. Since the variable is actually a colon-separated list of names that the current desktop is known as, we need to check if the value is set if we're using GNOME. [1] https://gitlab.gnome.org/GNOME/gnome-session/-/commit/00e0e6226371d53f65 Signed-off-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
1 parent 85b4e0a commit 5960a1c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

git-mergetool--lib.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,17 @@ run_merge_cmd () {
266266
fi
267267
}
268268

269+
is_desktop () {
270+
case ":$XDG_CURRENT_DESKTOP:" in
271+
*:$1:*)
272+
return 0
273+
;;
274+
*)
275+
return 1
276+
;;
277+
esac
278+
}
279+
269280
list_merge_tool_candidates () {
270281
if merge_mode
271282
then
@@ -275,7 +286,7 @@ list_merge_tool_candidates () {
275286
fi
276287
if test -n "$DISPLAY"
277288
then
278-
if test -n "$GNOME_DESKTOP_SESSION_ID"
289+
if is_desktop "GNOME" || if test -n "$GNOME_DESKTOP_SESSION_ID"
279290
then
280291
tools="meld opendiff kdiff3 tkdiff xxdiff $tools"
281292
else

0 commit comments

Comments
 (0)