From d55f6fb5fe467f812784ef34d53f3780885bd260 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 28 Jun 2019 12:58:59 +0100 Subject: [PATCH] gdesktopappinfo: Update calling convention for `gnome-terminal` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For several years now (I haven’t looked up the exact date), `gnome-terminal` has preferred being called as `gnome-terminal --terminal-args -- /some/other/program --its-args` rather than as `gnome-terminal --terminal-args -x /some/other/program --its-args`. Since 2017 it has warned about uses of `-x` (see https://gitlab.gnome.org/GNOME/gnome-terminal/commit/ad4edbd11874007bd73de29bfb2cedb8054644d1). So we should change our calling convention for it. Signed-off-by: Philip Withnall --- gio/gdesktopappinfo.c | 45 ++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index 69018cfdd..a484c63d4 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -2518,34 +2518,43 @@ prepend_terminal_to_vector (int *argc, term_argv = g_new0 (char *, 3); check = g_find_program_in_path ("gnome-terminal"); - if (check == NULL) - check = g_find_program_in_path ("mate-terminal"); - if (check == NULL) - check = g_find_program_in_path ("xfce4-terminal"); if (check != NULL) { term_argv[0] = check; - /* Note that gnome-terminal takes -x and - * as -e in gnome-terminal is broken we use that. */ - term_argv[1] = g_strdup ("-x"); + /* Since 2017, gnome-terminal has preferred `--` over `-x` or `-e`. */ + term_argv[1] = g_strdup ("--"); } else { if (check == NULL) - check = g_find_program_in_path ("nxterm"); - if (check == NULL) - check = g_find_program_in_path ("color-xterm"); - if (check == NULL) - check = g_find_program_in_path ("rxvt"); - if (check == NULL) - check = g_find_program_in_path ("dtterm"); + check = g_find_program_in_path ("mate-terminal"); if (check == NULL) + check = g_find_program_in_path ("xfce4-terminal"); + if (check != NULL) { - check = g_strdup ("xterm"); - g_debug ("Couldn’t find a terminal: falling back to xterm"); + term_argv[0] = check; + /* Note that gnome-terminal takes -x and + * as -e in gnome-terminal is broken we use that. */ + term_argv[1] = g_strdup ("-x"); + } + else + { + if (check == NULL) + check = g_find_program_in_path ("nxterm"); + if (check == NULL) + check = g_find_program_in_path ("color-xterm"); + if (check == NULL) + check = g_find_program_in_path ("rxvt"); + if (check == NULL) + check = g_find_program_in_path ("dtterm"); + if (check == NULL) + { + check = g_strdup ("xterm"); + g_debug ("Couldn’t find a terminal: falling back to xterm"); + } + term_argv[0] = check; + term_argv[1] = g_strdup ("-e"); } - term_argv[0] = check; - term_argv[1] = g_strdup ("-e"); } real_argc = term_argc + *argc;