From 936168e740067a8658c7097ff76588b070faa71f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 26 Jul 2018 22:42:58 +1000 Subject: Operate on floating split container when a child is focused --- sway/commands/scratchpad.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sway/commands/scratchpad.c') 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); } -- cgit v1.2.3-54-g00ecf