aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands/fullscreen.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c
index bc59201c..21c1e9a0 100644
--- a/sway/commands/fullscreen.c
+++ b/sway/commands/fullscreen.c
@@ -18,16 +18,13 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) {
18 return cmd_results_new(CMD_FAILURE, 18 return cmd_results_new(CMD_FAILURE,
19 "Can't run this command while there's no outputs connected."); 19 "Can't run this command while there's no outputs connected.");
20 } 20 }
21 struct sway_node *node = config->handler_context.node;
22 struct sway_container *container = config->handler_context.container; 21 struct sway_container *container = config->handler_context.container;
23 struct sway_workspace *workspace = config->handler_context.workspace;
24 if (node->type == N_WORKSPACE && workspace->tiling->length == 0) {
25 return cmd_results_new(CMD_FAILURE,
26 "Can't fullscreen an empty workspace");
27 }
28 22
29 // If in the scratchpad, operate on the highest container 23 if (!container) {
30 if (container && !container->pending.workspace) { 24 // If the focus is not a container, do nothing successfully
25 return cmd_results_new(CMD_SUCCESS, NULL);
26 } else if (!container->pending.workspace) {
27 // If in the scratchpad, operate on the highest container
31 while (container->pending.parent) { 28 while (container->pending.parent) {
32 container = container->pending.parent; 29 container = container->pending.parent;
33 } 30 }
@@ -49,13 +46,6 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) {
49 global = strcasecmp(argv[1], "global") == 0; 46 global = strcasecmp(argv[1], "global") == 0;
50 } 47 }
51 48
52 if (enable && node->type == N_WORKSPACE) {
53 // Wrap the workspace's children in a container so we can fullscreen it
54 container = workspace_wrap_children(workspace);
55 workspace->layout = L_HORIZ;
56 seat_set_focus_container(config->handler_context.seat, container);
57 }
58
59 enum sway_fullscreen_mode mode = FULLSCREEN_NONE; 49 enum sway_fullscreen_mode mode = FULLSCREEN_NONE;
60 if (enable) { 50 if (enable) {
61 mode = global ? FULLSCREEN_GLOBAL : FULLSCREEN_WORKSPACE; 51 mode = global ? FULLSCREEN_GLOBAL : FULLSCREEN_WORKSPACE;