]> Dogcows Code - chaz/openbox/blobdiff - plugins/placement/placement.c
change how rc parsing will work. a=b will be parsed in any [section] and given to...
[chaz/openbox] / plugins / placement / placement.c
index 2307db2ff4cf36d74c3e2d28789bf326d06cd92e..23ffbb5d9a47929b6280df8c3030f9e130c8da4e 100644 (file)
@@ -1,15 +1,31 @@
-#include "../../kernel/dispatch.h"
-#include "../../kernel/client.h"
-#include "../../kernel/frame.h"
-#include "../../kernel/screen.h"
-#include "../../kernel/openbox.h"
+#include "kernel/dispatch.h"
+#include "kernel/client.h"
+#include "kernel/frame.h"
+#include "kernel/screen.h"
+#include "kernel/openbox.h"
+#include "kernel/parse.h"
 #include "history.h"
 #include <glib.h>
 
-gboolean history = TRUE;
+static gboolean history;
+
+static void parse_assign(char *name, ParseToken *value)
+{
+    if  (!g_ascii_strcasecmp(name, "remember")) {
+        if (value->type != TOKEN_BOOL)
+            yyerror("invalid value");
+        else
+            history = value->data.bool;
+    } else
+        yyerror("invalid option");
+    parse_free_token(value);
+}
 
 void plugin_setup_config()
 {
+    history = TRUE;
+
+    parse_reg_section("placement", NULL, parse_assign);
 }
 
 static void place_random(Client *c)
@@ -44,7 +60,7 @@ static void event(ObEvent *e, void *foo)
     /* requested a position */
     if (e->data.c.client->positioned) return;
 
-    if (!place_history(e->data.c.client))
+    if (!history || !place_history(e->data.c.client))
         place_random(e->data.c.client);
 }
 
This page took 0.023402 seconds and 4 git commands to generate.