aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/fullscreen.c
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-07-25 20:56:23 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-07-26 08:27:07 +1000
commit27a20a488465468511de9b2307941ac1bc4db8bf (patch)
treec5c1aff483cb089870ffebec00869347eec29f4c /sway/commands/fullscreen.c
parentc8dc9b3b3094c9b2778309855114b9495518c2d4 (diff)
Allow containers to be fullscreen
Diffstat (limited to 'sway/commands/fullscreen.c')
-rw-r--r--sway/commands/fullscreen.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c
index b423fd23..5ad06e40 100644
--- a/sway/commands/fullscreen.c
+++ b/sway/commands/fullscreen.c
@@ -14,18 +14,24 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) {
}
struct sway_container *container =
config->handler_context.current_container;
- if (container->type != C_VIEW) {
+ if (container->type == C_WORKSPACE && container->children->length == 0) {
return cmd_results_new(CMD_INVALID, "fullscreen",
- "Only views can fullscreen");
+ "Can't fullscreen an empty workspace");
}
- struct sway_view *view = container->sway_view;
- bool wants_fullscreen = !view->is_fullscreen;
+ if (container->type == C_WORKSPACE) {
+ // Wrap the workspace's children in a container so we can fullscreen it
+ struct sway_container *workspace = container;
+ container = container_wrap_children(container);
+ workspace->layout = L_HORIZ;
+ seat_set_focus(config->handler_context.seat, container);
+ }
+ bool enable = !container->is_fullscreen;
if (argc) {
- wants_fullscreen = parse_boolean(argv[0], view->is_fullscreen);
+ enable = parse_boolean(argv[0], container->is_fullscreen);
}
- view_set_fullscreen(view, wants_fullscreen);
+ container_set_fullscreen(container, enable);
struct sway_container *workspace = container_parent(container, C_WORKSPACE);
arrange_windows(workspace->parent);