From 26b25b0d652e3a5b834eb004151f4a322c450403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 4 Aug 2020 14:23:42 +0200 Subject: [PATCH 1/2] mergetool-lib: use $XDG_CURRENT_DESKTOP to check GNOME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- git-mergetool--lib.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 204a5acd66f544..f9d8f309c8944d 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -266,6 +266,17 @@ run_merge_cmd () { fi } +is_desktop () { + case ":$XDG_CURRENT_DESKTOP:" in + *:$1:*) + return 0 + ;; + *) + return 1 + ;; + esac +} + list_merge_tool_candidates () { if merge_mode then @@ -275,7 +286,7 @@ list_merge_tool_candidates () { fi if test -n "$DISPLAY" then - if test -n "$GNOME_DESKTOP_SESSION_ID" + if is_desktop "GNOME" || test -n "$GNOME_DESKTOP_SESSION_ID" then tools="meld opendiff kdiff3 tkdiff xxdiff $tools" else From c18a5edf505cf8421f4465c9f6e26bce8d94d107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 4 Aug 2020 14:53:05 +0200 Subject: [PATCH 2/2] mergetool-lib: give kdiff3 priority in KDE environments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Trevisan (Treviño) --- git-mergetool--lib.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index f9d8f309c8944d..ac6695ea269f0c 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -289,6 +289,9 @@ list_merge_tool_candidates () { if is_desktop "GNOME" || test -n "$GNOME_DESKTOP_SESSION_ID" then tools="meld opendiff kdiff3 tkdiff xxdiff $tools" + elif is_desktop "KDE" || test x"$KDE_FULL_SESSION" = x"true" + then + tools="kdiff3 opendiff tkdiff xxdiff meld $tools" else tools="opendiff kdiff3 tkdiff xxdiff meld $tools" fi