mirror of
https://github.com/i3/i3.git
synced 2025-12-01 12:06:20 +00:00
Allow switching workspaces when in global fullscreen mode (#5398)
Fixes #2974
This commit is contained in:
1
release-notes/changes/3-global-fullscreen
Normal file
1
release-notes/changes/3-global-fullscreen
Normal file
@ -0,0 +1 @@
|
||||
Allow switching workspaces when in global fullscreen mode
|
||||
@ -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)) {
|
||||
|
||||
@ -185,7 +185,9 @@ cmd 'focus left';
|
||||
is($x->input_focus, $window->id, 'fullscreen window still focused');
|
||||
|
||||
################################################################################
|
||||
# Verify that changing workspace while in global fullscreen does not work.
|
||||
# Verify that changing workspace while in global fullscreen disables fullscreen
|
||||
# first.
|
||||
# See #2974
|
||||
################################################################################
|
||||
|
||||
$tmp = fresh_workspace;
|
||||
@ -197,11 +199,11 @@ is(focused_ws(), $tmp, 'workspace selected');
|
||||
|
||||
$other = get_unused_workspace;
|
||||
cmd "workspace $other";
|
||||
is($x->input_focus, $window->id, 'window still focused');
|
||||
is(focused_ws(), $tmp, 'workspace still selected');
|
||||
isnt($x->input_focus, $window->id, 'window not focused anymore');
|
||||
is(focused_ws(), $other, 'workspace switched');
|
||||
is_num_fullscreen($other, 0, 'no fullscreen windows');
|
||||
is_num_fullscreen($tmp, 0, 'no fullscreen windows');
|
||||
|
||||
# leave global fullscreen so that is does not interfere with the other tests
|
||||
$window->fullscreen(0);
|
||||
sync_with_i3;
|
||||
|
||||
################################################################################
|
||||
|
||||
Reference in New Issue
Block a user