-Workspace *workspace_get(int number) {
- Workspace *ws = NULL;
- TAILQ_FOREACH(ws, workspaces, workspaces)
- if (ws->num == number)
- return ws;
-
- /* If we are still there, we could not find the requested workspace. */
- int last_ws = TAILQ_LAST(workspaces, workspaces_head)->num;
-
- DLOG("We need to initialize that one, last ws = %d\n", last_ws);
-
- for (int c = last_ws; c < number; c++) {
- DLOG("Creating new ws\n");
-
- ws = scalloc(sizeof(Workspace));
- ws->num = c+1;
- TAILQ_INIT(&(ws->floating_clients));
- expand_table_cols(ws);
- expand_table_rows(ws);
- workspace_set_name(ws, NULL);
+Con *workspace_get(const char *num) {
+ Con *output, *workspace = NULL, *current;
+
+ /* TODO: could that look like this in the future?
+ GET_MATCHING_NODE(workspace, croot, strcasecmp(current->name, num) != 0);
+ */
+ TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
+ TAILQ_FOREACH(current, &(output->nodes_head), nodes) {
+ if (strcasecmp(current->name, num) != 0)
+ continue;
+
+ workspace = current;
+ break;
+ }
+ }