]> git.sur5r.net Git - i3/i3/blobdiff - src/config_directives.c
Validate that a binding mode is not defined more than once. (#2633)
[i3/i3] / src / config_directives.c
index a260518c3d533bb949ac08aaf989d5a5ffe4d54f..82e1a3461dc38e4c27eb4526817807de539e79c2 100644 (file)
@@ -126,6 +126,15 @@ CFGFUN(enter_mode, const char *pango_markup, const char *modename) {
         ELOG("You cannot use the name %s for your mode\n", DEFAULT_BINDING_MODE);
         exit(1);
     }
+
+    struct Mode *mode;
+    SLIST_FOREACH(mode, &modes, modes) {
+        if (strcmp(mode->name, modename) == 0) {
+            ELOG("The binding mode with name \"%s\" is defined at least twice.\n", modename);
+            exit(1);
+        }
+    }
+
     DLOG("\t now in mode %s\n", modename);
     FREE(current_mode);
     current_mode = sstrdup(modename);