Ref #676: Simultaneous runs of geeqie interfere with each other
authorColin Clark <cclark@carbon>
Mon, 3 Feb 2020 15:25:51 +0000 (15:25 +0000)
committerColin Clark <cclark@carbon>
Mon, 3 Feb 2020 15:25:51 +0000 (15:25 +0000)
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
src/typedefs.h

index c414bc8..3fcb811 100644 (file)
@@ -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)
                {
index d9d0007..8cd5582 100644 (file)
@@ -1060,6 +1060,7 @@ struct _CommandLine
        gchar *regexp;
        gchar *log_file;
        SecureSaveInfo *ssi;
+       gboolean new_instance;
 };
 
 #endif