summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/layout.h2
-rw-r--r--sway/commands.c25
-rw-r--r--sway/layout.c2
3 files changed, 28 insertions, 1 deletions
diff --git a/include/layout.h b/include/layout.h
index f462bdb3..cb38a7b1 100644
--- a/include/layout.h
+++ b/include/layout.h
@@ -8,6 +8,8 @@
8 8
9extern swayc_t root_container; 9extern swayc_t root_container;
10 10
11extern list_t *scratchpad;
12
11extern int min_sane_w; 13extern int min_sane_w;
12extern int min_sane_h; 14extern int min_sane_h;
13 15
diff --git a/sway/commands.c b/sway/commands.c
index 8a790384..55159a43 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -344,7 +344,7 @@ static bool cmd_focus_follows_mouse(struct sway_config *config, int argc, char *
344} 344}
345 345
346static bool cmd_move(struct sway_config *config, int argc, char **argv) { 346static bool cmd_move(struct sway_config *config, int argc, char **argv) {
347 if (!checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1)) { 347 if (!checkarg(argc, "move", EXPECTED_AT_LEAST, 1)) {
348 return false; 348 return false;
349 } 349 }
350 350
@@ -381,6 +381,28 @@ static bool cmd_move(struct sway_config *config, int argc, char **argv) {
381 ws = workspace_create(ws_name); 381 ws = workspace_create(ws_name);
382 } 382 }
383 move_container_to(view, get_focused_container(ws)); 383 move_container_to(view, get_focused_container(ws));
384 } else if (strcasecmp(argv[0], "scratchpad") == 0) {
385 int i;
386 swayc_t *view = get_focused_container(&root_container);
387 list_add(scratchpad, view);
388 if (view->is_floating) {
389 for (i = 0; i < view->parent->floating; i++) {
390 if (view->parent->floating->items[i] == view) {
391 list_del(view->parent->floating, i);
392 break;
393 }
394 }
395 wlc_view_set_mask(view->handle, 0);
396 } else {
397 for (i = 0; i < view->parent->children) {
398 if (view->parent->children->items[i] == view) {
399 list_del(view->parent->children, i);
400 break;
401 }
402 }
403 wlc_view_set_mask(view->handle, 0);
404 }
405 arrange_windows(&root_container, -1, -1);
384 } else { 406 } else {
385 return false; 407 return false;
386 } 408 }
@@ -742,6 +764,7 @@ static struct cmd_handler handlers[] = {
742 { "output", cmd_output}, 764 { "output", cmd_output},
743 { "reload", cmd_reload }, 765 { "reload", cmd_reload },
744 { "resize", cmd_resize }, 766 { "resize", cmd_resize },
767 { "scratchpad", cmd_scratchpad },
745 { "set", cmd_set }, 768 { "set", cmd_set },
746 { "split", cmd_split }, 769 { "split", cmd_split },
747 { "splith", cmd_splith }, 770 { "splith", cmd_splith },
diff --git a/sway/layout.c b/sway/layout.c
index b558e704..c7c5c477 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -10,6 +10,7 @@
10#include "focus.h" 10#include "focus.h"
11 11
12swayc_t root_container; 12swayc_t root_container;
13list_t *scratchpad;
13 14
14int min_sane_h = 60; 15int min_sane_h = 60;
15int min_sane_w = 100; 16int min_sane_w = 100;
@@ -20,6 +21,7 @@ void init_layout(void) {
20 root_container.children = create_list(); 21 root_container.children = create_list();
21 root_container.handle = -1; 22 root_container.handle = -1;
22 root_container.visible = true; 23 root_container.visible = true;
24 scratchpad = create_list();
23} 25}
24 26
25int index_child(const swayc_t *child) { 27int index_child(const swayc_t *child) {