summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
authorLibravatar Luminarys <kizunanohikari@gmail.com>2015-08-28 23:39:12 -0500
committerLibravatar Luminarys <kizunanohikari@gmail.com>2015-08-28 23:39:12 -0500
commit7eefecf4790bd0daf5c5727766c904c8c55dc6ee (patch)
tree2b65e4162d599e2bc2c0a706678f19b4b1c2fd14 /sway/commands.c
parentMerge pull request #147 from taiyu-len/master (diff)
downloadsway-7eefecf4790bd0daf5c5727766c904c8c55dc6ee.tar.gz
sway-7eefecf4790bd0daf5c5727766c904c8c55dc6ee.tar.zst
sway-7eefecf4790bd0daf5c5727766c904c8c55dc6ee.zip
Added in scratchpad adding
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c25
1 files changed, 24 insertions, 1 deletions
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 },