]> git.sur5r.net Git - i3/i3/commitdiff
swallows: value needs to be loaded as regular expression
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 14 Dec 2013 09:41:44 +0000 (10:41 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 22 Dec 2013 20:52:49 +0000 (21:52 +0100)
src/load_layout.c

index dbd1f0df17488861bf55ee8baec6a9777b9b7e43..0489c7f988e7693edd4419b762bb1cff5b8c0b5b 100644 (file)
@@ -153,10 +153,13 @@ static int json_string(void *ctx, const unsigned char *val, unsigned int len) {
     if (parsing_swallows) {
         /* TODO: the other swallowing keys */
         if (strcasecmp(last_key, "class") == 0) {
-            current_swallow->class = scalloc((len+1) * sizeof(char));
-            memcpy(current_swallow->class, val, len);
+            char *sval;
+            sasprintf(&sval, "%.*s", len, val);
+            current_swallow->class = regex_new(sval);
+            free(sval);
+        } else {
+            ELOG("swallow key %s unknown\n", last_key);
         }
-        LOG("unhandled yet: swallow\n");
     } else {
         if (strcasecmp(last_key, "name") == 0) {
             json_node->name = scalloc((len+1) * sizeof(char));