X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fworkspace.c;h=4e93b92e08079613bdbdc17fd487f22217e2e2cd;hb=2f992f5c0ed75452a61b19d6c118e5f5f3ba67e9;hp=77b5ceb2eca52b91276ecd13d3d0ce7214ef9f42;hpb=c0563af3e27543d97eb3d201c2e197cc6285cb80;p=i3%2Fi3 diff --git a/src/workspace.c b/src/workspace.c index 77b5ceb2..4e93b92e 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -59,7 +59,18 @@ Con *workspace_get(const char *num, bool *created) { workspace->num = -1; else workspace->num = parsed_num; LOG("num = %d\n", workspace->num); - workspace->orientation = HORIZ; + + /* If default_orientation is set to NO_ORIENTATION we + * determine workspace orientation from workspace size. + * Otherwise we just set the orientation to default_orientation. */ + if (config.default_orientation == NO_ORIENTATION) { + workspace->orientation = (output->rect.height > output->rect.width) ? VERT : HORIZ; + DLOG("Auto orientation. Output resolution set to (%d,%d), setting orientation to %d.\n", + workspace->rect.width, workspace->rect.height, workspace->orientation); + } else { + workspace->orientation = config.default_orientation; + } + con_attach(workspace, content, false); ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"init\"}");