Skip to content

Commit

Permalink
nemo-view.c & nemo-window-menus.c: Add support for terminals with whi…
Browse files Browse the repository at this point in the history
…tespace in the exec (#3379)

* Flatpak terminals in particular will be supported
* Closes #3372
  • Loading branch information
rcalixte authored May 27, 2024
1 parent 8d3669d commit 37571e9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
25 changes: 20 additions & 5 deletions src/nemo-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -7121,11 +7121,26 @@ open_as_root (NemoView *view, const gchar *path)
static void
open_in_terminal (const gchar *path)
{
gchar *argv[2];
argv[0] = g_settings_get_string (gnome_terminal_preferences,
GNOME_DESKTOP_TERMINAL_EXEC);
argv[1] = NULL;
g_spawn_async(path, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
gchar *gsetting_terminal;
gchar **token;
gchar **argv;
gint i;

gsetting_terminal = g_settings_get_string (gnome_terminal_preferences,
GNOME_DESKTOP_TERMINAL_EXEC);

token = g_strsplit (gsetting_terminal, " ", 0);
argv = g_new (gchar *, g_strv_length (token) + 1);
for (i = 0; token[i] != NULL; i++) {
argv[i] = token[i];
}
argv[i] = NULL;

g_spawn_async (path, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);

g_free (gsetting_terminal);
g_strfreev (token);
g_free (argv);
}

static void
Expand Down
24 changes: 20 additions & 4 deletions src/nemo-window-menus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,26 @@ action_new_folder_callback (GtkAction *action,
static void
open_in_terminal_other (const gchar *path)
{
gchar *argv[2];
argv[0] = g_settings_get_string (gnome_terminal_preferences, GNOME_DESKTOP_TERMINAL_EXEC);
argv[1] = NULL;
g_spawn_async(path, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
gchar *gsetting_terminal;
gchar **token;
gchar **argv;
gint i;

gsetting_terminal = g_settings_get_string (gnome_terminal_preferences,
GNOME_DESKTOP_TERMINAL_EXEC);

token = g_strsplit (gsetting_terminal, " ", 0);
argv = g_new (gchar *, g_strv_length (token) + 1);
for (i = 0; token[i] != NULL; i++) {
argv[i] = token[i];
}
argv[i] = NULL;

g_spawn_async (path, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);

g_free (gsetting_terminal);
g_strfreev (token);
g_free (argv);
}


Expand Down

0 comments on commit 37571e9

Please sign in to comment.