]> Dogcows Code - chaz/openbox/commitdiff
don't reload the session on restart
authorDana Jansens <danakj@orodu.net>
Tue, 22 May 2007 00:05:28 +0000 (00:05 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 22 May 2007 00:05:28 +0000 (00:05 +0000)
openbox/openbox.c
openbox/openbox.h
openbox/session.c

index f66f6a762e4d748f2add4314619775dbd368cbec..b69f2c1e41fac5d08be5544dd9bd4a31140dc0f5 100644 (file)
@@ -92,6 +92,7 @@ gboolean    ob_replace_wm = FALSE;
 gboolean    ob_sm_use = TRUE;
 gchar      *ob_sm_id = NULL;
 gchar      *ob_sm_save_file = NULL;
+gboolean    ob_sm_restore = TRUE;
 gboolean    ob_debug_xinerama = FALSE;
 
 static ObState   state;
@@ -396,12 +397,13 @@ gint main(gint argc, gchar **argv)
             }
         }
 
-        /* we remove the session arguments from argv, so put them back */
+        /* we remove the session arguments from argv, so put them back,
+           also don't restore the session on restart */
         if (ob_sm_save_file != NULL || ob_sm_id != NULL) {
             gchar **nargv;
             gint i, l;
 
-            l = argc +
+            l = argc + 1 +
                 (ob_sm_save_file != NULL ? 2 : 0) +
                 (ob_sm_id != NULL ? 2 : 0);
             nargv = g_new0(gchar*, l+1);
@@ -416,6 +418,7 @@ gint main(gint argc, gchar **argv)
                 nargv[i++] = g_strdup("--sm-client-id");
                 nargv[i++] = ob_sm_id;
             }
+            nargv[i++] = g_strdup("--sm-no-load");
             g_assert(i == l);
             argv = nargv;
         }
@@ -572,6 +575,11 @@ static void parse_args(gint *argc, gchar **argv)
         else if (!strcmp(argv[i], "--sm-disable")) {
             ob_sm_use = FALSE;
         }
+        else if (!strcmp(argv[i], "--sm-no-load")) {
+            ob_sm_restore = FALSE;
+            remove_args(argc, argv, i, 1);
+            --i; /* this arg was removed so go back */
+        }
         else {
             /* this is a memleak.. oh well.. heh */
             gchar *err = g_strdup_printf
index e258d31e25f6dd5c8a90a93c7ed40d839d5b9920..460de0b46b31382d767b99ef82c3414316210a6c 100644 (file)
@@ -45,6 +45,7 @@ extern gchar   *ob_sm_id;
 /* This save_file will get pass to ourselves if we restart too! So we won't
  make a new file every time, yay. */
 extern gchar   *ob_sm_save_file;
+extern gboolean ob_sm_restore;
 extern gboolean ob_replace_wm;
 extern gboolean ob_debug_xinerama;
 
index d0db0717ffeaf2bf467c8232a090b4d30a12a0fa..dcb3fcef2433a891d7b86021b47ba7d3033e1249 100644 (file)
@@ -102,9 +102,11 @@ void session_startup(gint argc, gchar **argv)
     }
 
     if (ob_sm_save_file != NULL) {
-        ob_debug_type(OB_DEBUG_SM, "Loading from session file %s\n",
-                      ob_sm_save_file);
-        session_load_file(ob_sm_save_file);
+        if (ob_sm_restore) {
+            ob_debug_type(OB_DEBUG_SM, "Loading from session file %s\n",
+                          ob_sm_save_file);
+            session_load_file(ob_sm_save_file);
+        }
     } else {
         gchar *filename;
 
This page took 0.027486 seconds and 4 git commands to generate.