aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/scratchpad.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-26 22:42:58 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-28 22:41:04 +1000
commit936168e740067a8658c7097ff76588b070faa71f (patch)
treec16935258c2b040f4a49a236893801bfe9331be2 /sway/commands/scratchpad.c
parentFix crash when a child of a floating container is in the scratchpad (diff)
downloadsway-936168e740067a8658c7097ff76588b070faa71f.tar.gz
sway-936168e740067a8658c7097ff76588b070faa71f.tar.zst
sway-936168e740067a8658c7097ff76588b070faa71f.zip
Operate on floating split container when a child is focused
Diffstat (limited to 'sway/commands/scratchpad.c')
-rw-r--r--sway/commands/scratchpad.c12
1 files changed, 10 insertions, 2 deletions
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) {
19 } 19 }
20 20
21 if (config->handler_context.using_criteria) { 21 if (config->handler_context.using_criteria) {
22 struct sway_container *con = config->handler_context.current_container;
23
24 // If the container is in a floating split container,
25 // operate on the split container instead of the child.
26 if (container_is_floating_or_child(con)) {
27 while (con->parent->layout != L_FLOATING) {
28 con = con->parent;
29 }
30 }
31
22 // If using criteria, this command is executed for every container which 32 // If using criteria, this command is executed for every container which
23 // matches the criteria. If this container isn't in the scratchpad, 33 // matches the criteria. If this container isn't in the scratchpad,
24 // we'll just silently return a success. 34 // we'll just silently return a success.
25 struct sway_container *con = config->handler_context.current_container;
26 wlr_log(WLR_INFO, "cmd_scratchpad(%s)", con->name);
27 if (!con->scratchpad) { 35 if (!con->scratchpad) {
28 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 36 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
29 } 37 }