X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcommands.c;h=9b51b3ecc7cba9d7561819d77a42519fd757d142;hb=822cd3bf1b95a61667bfa186ff2093ecd317a3a6;hp=80f57b810ba1f9c7b8cb941ca79d4873b20f2521;hpb=f2b728ac5ec00d004f954f85077635668f21fbfd;p=i3%2Fi3 diff --git a/src/commands.c b/src/commands.c index 80f57b81..9b51b3ec 100644 --- a/src/commands.c +++ b/src/commands.c @@ -494,27 +494,7 @@ void cmd_move_con_to_workspace_name(I3_CMD, char *name) { LOG("should move window to workspace %s\n", name); /* get the workspace */ - Con *ws = NULL; - Con *output = NULL; - - /* first look for a workspace with this name */ - TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { - GREP_FIRST(ws, output_get_content(output), !strcasecmp(child->name, name)); - } - - /* if the name is plain digits, we interpret this as a "workspace number" - * command */ - if (!ws && name_is_digits(name)) { - long parsed_num = ws_name_to_number(name); - TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { - GREP_FIRST(ws, output_get_content(output), - child->num == parsed_num); - } - } - - /* if no workspace was found, make a new one */ - if (!ws) - ws = workspace_get(name, NULL); + Con *ws = workspace_get(name, NULL); ws = maybe_auto_back_and_forth_workspace(ws); @@ -1049,30 +1029,7 @@ void cmd_workspace_name(I3_CMD, char *name) { DLOG("should switch to workspace %s\n", name); if (maybe_back_and_forth(cmd_output, name)) return; - - Con *ws = NULL; - Con *output = NULL; - - /* first look for a workspace with this name */ - TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { - GREP_FIRST(ws, output_get_content(output), !strcasecmp(child->name, name)); - } - - /* if the name is only digits, we interpret this as a "workspace number" - * command */ - if (!ws && name_is_digits(name)) { - long parsed_num = ws_name_to_number(name); - TAILQ_FOREACH(output, &(croot->nodes_head), nodes) { - GREP_FIRST(ws, output_get_content(output), - child->num == parsed_num); - } - } - - /* if no workspace was found, make a new one */ - if (!ws) - ws = workspace_get(name, NULL); - - workspace_show(ws); + workspace_show_by_name(name); cmd_output->needs_tree_render = true; // XXX: default reply for now, make this a better reply