]> git.sur5r.net Git - i3/i3/blobdiff - src/config.c
Update website to use the new design
[i3/i3] / src / config.c
index 5d6312edfb3c69ac57414c745b6dcfaad428f10d..2c2ba0453e9b0a7683936a661bcbca5f9935dde7 100644 (file)
@@ -215,6 +215,30 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath)
                         continue;
                 }
 
+                if (strcasecmp(key, "floating_modifier") == 0) {
+                        char *walk = value;
+                        uint32_t modifiers = 0;
+
+                        while (*walk != '\0') {
+                                /* Need to check for Mod1-5, Ctrl, Shift, Mode_switch */
+                                CHECK_MODIFIER(SHIFT);
+                                CHECK_MODIFIER(CONTROL);
+                                CHECK_MODIFIER(MODE_SWITCH);
+                                CHECK_MODIFIER(MOD1);
+                                CHECK_MODIFIER(MOD2);
+                                CHECK_MODIFIER(MOD3);
+                                CHECK_MODIFIER(MOD4);
+                                CHECK_MODIFIER(MOD5);
+
+                                /* No modifier found? Then we’re done with this step */
+                                break;
+                        }
+
+                        LOG("Floating modifiers = %d\n", modifiers);
+                        config.floating_modifier = modifiers;
+                        continue;
+                }
+
                 /* assign window class[/window title] → workspace */
                 if (strcasecmp(key, "assign") == 0) {
                         LOG("assign: \"%s\"\n", value);
@@ -236,19 +260,25 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath)
                                 *end = '\0';
                         }
 
+                        /* Strip trailing whitespace */
+                        while (strlen(value) > 0 && value[strlen(value)-1] == ' ')
+                                value[strlen(value)-1] = '\0';
+
                         /* The target is the last argument separated by a space */
                         if ((target = strrchr(value, ' ')) == NULL)
                                 die("Malformed assignment, couldn't find target\n");
                         target++;
 
-                        if (atoi(target) < 1 || atoi(target) > 10)
+                        if (*target != '~' && (atoi(target) < 1 || atoi(target) > 10))
                                 die("Malformed assignment, invalid workspace number\n");
 
                         LOG("assignment parsed: \"%s\" to \"%s\"\n", class_title, target);
 
-                        struct Assignment *new = smalloc(sizeof(struct Assignment));
+                        struct Assignment *new = scalloc(sizeof(struct Assignment));
                         new->windowclass_title = class_title;
-                        new->workspace = atoi(target);
+                        if (*target == '~')
+                                new->floating = true;
+                        else new->workspace = atoi(target);
                         TAILQ_INSERT_TAIL(&assignments, new, assignments);
                         continue;
                 }