From b490f679254f03d67fb8d9a6a80c9e93393bebea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20B=C3=BCrk?= Date: Wed, 16 Sep 2015 19:51:09 +0200 Subject: [PATCH] Use the focused container to determine the target window_mode when using floating mode_toggle. This fixes mode_toggle in case the workspace is focused and only a floating sticky window is open. fixes #1927 --- src/commands.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/commands.c b/src/commands.c index 81896047..1472a812 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1414,15 +1414,14 @@ void cmd_focus_window_mode(I3_CMD, char *window_mode) { DLOG("window_mode = %s\n", window_mode); Con *ws = con_get_workspace(focused); - Con *current; if (ws != NULL) { if (strcmp(window_mode, "mode_toggle") == 0) { - current = TAILQ_FIRST(&(ws->focus_head)); - if (current != NULL && current->type == CT_FLOATING_CON) + if (con_inside_floating(focused)) window_mode = "tiling"; else window_mode = "floating"; } + Con *current; TAILQ_FOREACH(current, &(ws->focus_head), focused) { if ((strcmp(window_mode, "floating") == 0 && current->type != CT_FLOATING_CON) || (strcmp(window_mode, "tiling") == 0 && current->type == CT_FLOATING_CON))