Add error reply to cmd_focus_window_mode
This commit is contained in:
parent
df437aa87e
commit
2592c63603
|
@ -1257,28 +1257,34 @@ void cmd_focus_direction(I3_CMD, const char *direction) {
|
||||||
void cmd_focus_window_mode(I3_CMD, const char *window_mode) {
|
void cmd_focus_window_mode(I3_CMD, const char *window_mode) {
|
||||||
DLOG("window_mode = %s\n", window_mode);
|
DLOG("window_mode = %s\n", window_mode);
|
||||||
|
|
||||||
Con *ws = con_get_workspace(focused);
|
bool to_floating = false;
|
||||||
if (ws != NULL) {
|
if (strcmp(window_mode, "mode_toggle") == 0) {
|
||||||
if (strcmp(window_mode, "mode_toggle") == 0) {
|
to_floating = !con_inside_floating(focused);
|
||||||
if (con_inside_floating(focused))
|
} else if (strcmp(window_mode, "floating") == 0) {
|
||||||
window_mode = "tiling";
|
to_floating = true;
|
||||||
else
|
} else if (strcmp(window_mode, "tiling") == 0) {
|
||||||
window_mode = "floating";
|
to_floating = false;
|
||||||
}
|
|
||||||
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))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
con_focus(con_descend_focused(current));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_output->needs_tree_render = true;
|
Con *ws = con_get_workspace(focused);
|
||||||
// XXX: default reply for now, make this a better reply
|
Con *current;
|
||||||
ysuccess(true);
|
bool success = false;
|
||||||
|
TAILQ_FOREACH(current, &(ws->focus_head), focused) {
|
||||||
|
if ((to_floating && current->type != CT_FLOATING_CON) ||
|
||||||
|
(!to_floating && current->type == CT_FLOATING_CON))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
con_focus(con_descend_focused(current));
|
||||||
|
success = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
cmd_output->needs_tree_render = true;
|
||||||
|
ysuccess(true);
|
||||||
|
} else {
|
||||||
|
yerror("Failed to find a %s container in workspace.", to_floating ? "floating" : "tiling");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue