X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fconfig_directives.c;h=376397e8abe877146b9c7cb85fdd563ea832a3c0;hb=eaf7a49e28b7ff8e1820a1b23350647574a0ed5a;hp=7ca6e102785a674daa3741e5f884fd68ebc958ab;hpb=2dc13211a5cfc78fb1bb2c6269f251518fd14aee;p=i3%2Fi3 diff --git a/src/config_directives.c b/src/config_directives.c index 7ca6e102..376397e8 100644 --- a/src/config_directives.c +++ b/src/config_directives.c @@ -377,15 +377,21 @@ CFGFUN(color, const char *colorclass, const char *border, const char *background #undef APPLY_COLORS } -CFGFUN(assign, const char *workspace) { +CFGFUN(assign, const char *workspace, bool is_number) { if (match_is_empty(current_match)) { ELOG("Match is empty, ignoring this assignment\n"); return; } + + if (is_number && ws_name_to_number(workspace) == -1) { + ELOG("Could not parse initial part of \"%s\" as a number.\n", workspace); + return; + } + DLOG("New assignment, using above criteria, to workspace \"%s\".\n", workspace); Assignment *assignment = scalloc(1, sizeof(Assignment)); match_copy(&(assignment->match), current_match); - assignment->type = A_TO_WORKSPACE; + assignment->type = is_number ? A_TO_WORKSPACE_NUMBER : A_TO_WORKSPACE; assignment->dest.workspace = sstrdup(workspace); TAILQ_INSERT_TAIL(&assignments, assignment, assignments); }