From 92b4e3e7257ed48a1d3e5389bac8f7e326ef4829 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Mon, 3 Feb 2020 15:25:51 +0000 Subject: [PATCH] Ref #676: Simultaneous runs of geeqie interfere with each other https://github.com/BestImageViewer/geeqie/issues/676 A new command line option: geeqie -n geeqie --new-instance This option reverts geeqie to its previous behavior on start-up. Note that there is only one geeqierc.xml file. --- src/main.c | 30 +++++++++++++++++++++--------- src/typedefs.h | 1 + 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/main.c b/src/main.c index c414bc89..3fcb8118 100644 --- a/src/main.c +++ b/src/main.c @@ -338,6 +338,14 @@ static void parse_command_line(gint argc, gchar *argv[]) { set_regexp(g_strdup(cmd_line+3)); } + else if (strncmp(cmd_line, "-n", 2) == 0) + { + command_line->new_instance = TRUE; + } + else if (strncmp(cmd_line, "--new-instance", 14) == 0) + { + command_line->new_instance = TRUE; + } else if (strcmp(cmd_line, "-rh") == 0 || strcmp(cmd_line, "--remote-help") == 0) { @@ -373,6 +381,7 @@ static void parse_command_line(gint argc, gchar *argv[]) print_term(FALSE, _(" -l, --list [files] [collections] open collection window for command line\n")); print_term(FALSE, _(" --blank start with blank file list\n")); print_term(FALSE, _(" --geometry=XxY+XOFF+YOFF set main window location\n")); + print_term(FALSE, _(" -n, --new-instance open a new instance of Geeqie\n")); print_term(FALSE, _(" -r, --remote send following commands to open window\n")); print_term(FALSE, _(" -rh,--remote-help print remote command list\n")); #ifdef DEBUG @@ -418,16 +427,19 @@ static void parse_command_line(gint argc, gchar *argv[]) } g_free(first_dir); - /* If Geeqie is already running, prevent a second instance - * from being started. Open a new window instead. - */ - app_lock = g_build_filename(get_rc_dir(), ".command", NULL); - if (remote_server_exists(app_lock) && !remote_do) + if (!command_line->new_instance) { - remote_do = TRUE; - remote_list = g_list_append(remote_list, "--new-window"); - } - g_free(app_lock); + /* If Geeqie is already running, prevent a second instance + * from being started. Open a new window instead. + */ + app_lock = g_build_filename(get_rc_dir(), ".command", NULL); + if (remote_server_exists(app_lock) && !remote_do) + { + remote_do = TRUE; + remote_list = g_list_append(remote_list, "--new-window"); + } + g_free(app_lock); + } if (remote_do) { diff --git a/src/typedefs.h b/src/typedefs.h index d9d00079..8cd55823 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -1060,6 +1060,7 @@ struct _CommandLine gchar *regexp; gchar *log_file; SecureSaveInfo *ssi; + gboolean new_instance; }; #endif -- 2.20.1