aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-07-26 22:42:58 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-07-28 22:41:04 +1000
commit936168e740067a8658c7097ff76588b070faa71f (patch)
treec16935258c2b040f4a49a236893801bfe9331be2 /sway/commands
parent902a1402ba35be3fbc3c054cd7af5a8bda5f8fd6 (diff)
Operate on floating split container when a child is focused
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/floating.c8
-rw-r--r--sway/commands/scratchpad.c12
2 files changed, 18 insertions, 2 deletions
diff --git a/sway/commands/floating.c b/sway/commands/floating.c
index b67e736f..31de5ec3 100644
--- a/sway/commands/floating.c
+++ b/sway/commands/floating.c
@@ -29,6 +29,14 @@ struct cmd_results *cmd_floating(int argc, char **argv) {
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;
if (strcasecmp(argv[0], "enable") == 0) {
wants_floating = true;
diff --git a/sway/commands/scratchpad.c b/sway/commands/scratchpad.c
index ccc07c87..01a91d65 100644
--- a/sway/commands/scratchpad.c
+++ b/sway/commands/scratchpad.c
@@ -19,11 +19,19 @@ struct cmd_results *cmd_scratchpad(int argc, char **argv) {
}
if (config->handler_context.using_criteria) {
+ struct sway_container *con = config->handler_context.current_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(con)) {
+ while (con->parent->layout != L_FLOATING) {
+ con = con->parent;
+ }
+ }
+
// If using criteria, this command is executed for every container which
// matches the criteria. If this container isn't in the scratchpad,
// we'll just silently return a success.
- struct sway_container *con = config->handler_context.current_container;
- wlr_log(WLR_INFO, "cmd_scratchpad(%s)", con->name);
if (!con->scratchpad) {
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}