workspace->type = CT_WORKSPACE;
FREE(workspace->name);
workspace->name = sstrdup(num);
+ workspace->workspace_layout = config.default_layout;
/* We set ->num to the number if this workspace’s name begins with a
* positive number. Otherwise it’s a named ws and num will be -1. */
char *endptr = NULL;
*/
void workspace_show_by_name(const char *num) {
Con *workspace;
- bool changed_num_workspaces;
- workspace = workspace_get(num, &changed_num_workspaces);
+ workspace = workspace_get(num, NULL);
_workspace_show(workspace);
}
workspace_show_by_name(previous_workspace_name);
}
+/*
+ * Returns the previously focused workspace con, or NULL if unavailable.
+ *
+ */
+Con *workspace_back_and_forth_get(void) {
+ if (!previous_workspace_name) {
+ DLOG("no previous workspace name set.");
+ return NULL;
+ }
+
+ Con *workspace;
+ workspace = workspace_get(previous_workspace_name, NULL);
+
+ return workspace;
+}
+
static bool get_urgency_flag(Con *con) {
Con *child;
TAILQ_FOREACH(child, &(con->nodes_head), nodes)
Con *workspace_attach_to(Con *ws) {
DLOG("Attaching a window to workspace %p / %s\n", ws, ws->name);
- if (config.default_layout == L_DEFAULT) {
+ if (ws->workspace_layout == L_DEFAULT) {
DLOG("Default layout, just attaching it to the workspace itself.\n");
return ws;
}
new->split = true;
/* 2: set the requested layout on the split con */
- new->layout = config.default_layout;
+ new->layout = ws->workspace_layout;
/* 4: attach the new split container to the workspace */
DLOG("Attaching new split %p to workspace %p\n", new, ws);