From 8aaba944a81d85d9f8a0ae29f4314e303c420853 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Fri, 22 Feb 2019 00:10:02 -0500 Subject: move scratchpad: hide visible scratchpad container This makes it so running `move [to] scratchpad` on a container already in the scratchpad does not return an error. To match i3's behavior, a visible scratchpad container will be hidden and a hidden scratchpad container will be treated as a noop. --- sway/commands/move.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sway/commands/move.c b/sway/commands/move.c index b593138a..4306aac8 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -854,11 +854,11 @@ static struct cmd_results *cmd_move_to_scratchpad(void) { } } - if (con->scratchpad) { - return cmd_results_new(CMD_INVALID, - "Container is already in the scratchpad"); + if (!con->scratchpad) { + root_scratchpad_add_container(con); + } else if (con->workspace) { + root_scratchpad_hide(con); } - root_scratchpad_add_container(con); return cmd_results_new(CMD_SUCCESS, NULL); } -- cgit v1.2.3-54-g00ecf