aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/floating.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-07-28 09:30:12 -0400
committerGitHub <noreply@github.com>2018-07-28 09:30:12 -0400
commit53069f1403587d230e8f2c6adb61daa7c5e022b7 (patch)
tree67b966d2736ba19540b0102381710f9fb5316e61 /sway/commands/floating.c
parente4b54ac16e52cea9fe7f8385e87033764d36522f (diff)
parent0337609667ad1d01e0e0dc19231373df3fbf7c87 (diff)
Merge pull request #2360 from RyanDwyer/floating-containers
Allow containers to float
Diffstat (limited to 'sway/commands/floating.c')
-rw-r--r--sway/commands/floating.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sway/commands/floating.c b/sway/commands/floating.c
index 6ab56c3b..31de5ec3 100644
--- a/sway/commands/floating.c
+++ b/sway/commands/floating.c
@@ -17,9 +17,24 @@ struct cmd_results *cmd_floating(int argc, char **argv) {
}
struct sway_container *container =
config->handler_context.current_container;
- if (container->type != C_VIEW) {
- // TODO: This doesn't strictly speaking have to be true
- return cmd_results_new(CMD_INVALID, "float", "Only views can float");
+ if (container->type == C_WORKSPACE && container->children->length == 0) {
+ return cmd_results_new(CMD_INVALID, "floating",
+ "Can't float an empty workspace");
+ }
+ if (container->type == C_WORKSPACE) {
+ // Wrap the workspace's children in a container so we can float it
+ struct sway_container *workspace = container;
+ container = container_wrap_children(container);
+ workspace->layout = L_HORIZ;
+ seat_set_focus(config->handler_context.seat, container);
+ }
+
+ // If the container is in a floating split container,
+ // operate on the split container instead of the child.
+ if (container_is_floating_or_child(container)) {
+ while (container->parent->layout != L_FLOATING) {
+ container = container->parent;
+ }
}
bool wants_floating;