Skip to content

Commit 5032cfc

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 check the XDG_CURRENT_DESKTOP env variable, that is 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 go through all the values to ensure we're using GNOME. [1] https://gitlab.gnome.org/GNOME/gnome-session/-/commit/00e0e6226371d53f65 Signed-off-by: Marco Trevisan (Treviño) <[email protected]>
1 parent 85b4e0a commit 5032cfc

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

git-mergetool--lib.sh

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

269+
is_desktop () {
270+
IFS=':'
271+
for desktop in ${XDG_CURRENT_DESKTOP}
272+
do
273+
if test "$desktop" = "$1"
274+
then
275+
return 0
276+
fi
277+
done
278+
279+
return 1
280+
}
281+
269282
list_merge_tool_candidates () {
270283
if merge_mode
271284
then
@@ -275,7 +288,7 @@ list_merge_tool_candidates () {
275288
fi
276289
if test -n "$DISPLAY"
277290
then
278-
if test -n "$GNOME_DESKTOP_SESSION_ID"
291+
if is_desktop "GNOME"
279292
then
280293
tools="meld opendiff kdiff3 tkdiff xxdiff $tools"
281294
else

0 commit comments

Comments
 (0)