]> git.sur5r.net Git - i3/i3/blobdiff - src/commands.c
Revert "Workspace command number selection"
[i3/i3] / src / commands.c
index 80f57b810ba1f9c7b8cb941ca79d4873b20f2521..9b51b3ecc7cba9d7561819d77a42519fd757d142 100644 (file)
@@ -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