diff options
author | Luminarys <kizunanohikari@gmail.com> | 2015-08-28 23:39:12 -0500 |
---|---|---|
committer | Luminarys <kizunanohikari@gmail.com> | 2015-08-28 23:39:12 -0500 |
commit | 7eefecf4790bd0daf5c5727766c904c8c55dc6ee (patch) | |
tree | 2b65e4162d599e2bc2c0a706678f19b4b1c2fd14 | |
parent | Merge pull request #147 from taiyu-len/master (diff) | |
download | sway-7eefecf4790bd0daf5c5727766c904c8c55dc6ee.tar.gz sway-7eefecf4790bd0daf5c5727766c904c8c55dc6ee.tar.zst sway-7eefecf4790bd0daf5c5727766c904c8c55dc6ee.zip |
Added in scratchpad adding
-rw-r--r-- | include/layout.h | 2 | ||||
-rw-r--r-- | sway/commands.c | 25 | ||||
-rw-r--r-- | sway/layout.c | 2 |
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 | ||
9 | extern swayc_t root_container; | 9 | extern swayc_t root_container; |
10 | 10 | ||
11 | extern list_t *scratchpad; | ||
12 | |||
11 | extern int min_sane_w; | 13 | extern int min_sane_w; |
12 | extern int min_sane_h; | 14 | extern 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 | ||
346 | static bool cmd_move(struct sway_config *config, int argc, char **argv) { | 346 | static 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 | ||
12 | swayc_t root_container; | 12 | swayc_t root_container; |
13 | list_t *scratchpad; | ||
13 | 14 | ||
14 | int min_sane_h = 60; | 15 | int min_sane_h = 60; |
15 | int min_sane_w = 100; | 16 | int 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 | ||
25 | int index_child(const swayc_t *child) { | 27 | int index_child(const swayc_t *child) { |