diff options
Diffstat (limited to 'src/commands.c')
-rw-r--r-- | src/commands.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/commands.c b/src/commands.c index a2f42dce..b5bc2416 100644 --- a/src/commands.c +++ b/src/commands.c @@ -844,6 +844,13 @@ out: free(buf); } +static void disable_global_fullscreen(void) { + Con *fs = con_get_fullscreen_con(croot, CF_GLOBAL); + if (fs) { + con_disable_fullscreen(fs); + } +} + /* * Implementation of 'workspace next|prev|next_on_output|prev_on_output'. * @@ -853,10 +860,7 @@ void cmd_workspace(I3_CMD, const char *which) { DLOG("which=%s\n", which); - if (con_get_fullscreen_con(croot, CF_GLOBAL)) { - yerror("Cannot switch workspace while in global fullscreen"); - return; - } + disable_global_fullscreen(); if (strcmp(which, "next") == 0) ws = workspace_next(); @@ -885,10 +889,7 @@ void cmd_workspace(I3_CMD, const char *which) { void cmd_workspace_number(I3_CMD, const char *which, const char *_no_auto_back_and_forth) { const bool no_auto_back_and_forth = (_no_auto_back_and_forth != NULL); - if (con_get_fullscreen_con(croot, CF_GLOBAL)) { - yerror("Cannot switch workspace while in global fullscreen"); - return; - } + disable_global_fullscreen(); long parsed_num = ws_name_to_number(which); if (parsed_num == -1) { @@ -920,10 +921,7 @@ void cmd_workspace_number(I3_CMD, const char *which, const char *_no_auto_back_a * */ void cmd_workspace_back_and_forth(I3_CMD) { - if (con_get_fullscreen_con(croot, CF_GLOBAL)) { - yerror("Cannot switch workspace while in global fullscreen"); - return; - } + disable_global_fullscreen(); workspace_back_and_forth(); @@ -944,10 +942,7 @@ void cmd_workspace_name(I3_CMD, const char *name, const char *_no_auto_back_and_ return; } - if (con_get_fullscreen_con(croot, CF_GLOBAL)) { - yerror("Cannot switch workspace while in global fullscreen"); - return; - } + disable_global_fullscreen(); DLOG("should switch to workspace %s\n", name); if (!no_auto_back_and_forth && maybe_back_and_forth(cmd_output, name)) { |