+
+#include "all.h"
+
+/*
+ * Returns a pointer to the workspace with the given number (starting at 0),
+ * creating the workspace if necessary (by allocating the necessary amount of
+ * memory and initializing the data structures correctly).
+ *
+ */
+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;
+ }
+ }
+
+ LOG("getting ws %s\n", num);
+ if (workspace == NULL) {
+ LOG("need to create this one\n");
+ output = con_get_output(focused);
+ LOG("got output %p\n", output);
+ workspace = con_new(output);
+ workspace->name = strdup(num);
+
+ ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"init\"}");
+ }
+
+ //ewmh_update_workarea();
+
+ return workspace;
+}
+
+#if 0