aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-03-01 13:24:47 -0500
committerLibravatar GitHub <noreply@github.com>2017-03-01 13:24:47 -0500
commitd6ac3021ceafdf7e3a876a3764cc553f4df6b8cc (patch)
treee90c86a30595ed7a18713a19fe9d26e8fa30a2c4 /sway/commands
parentFix #1087 (diff)
parentClarify move documentation for floating containers (diff)
downloadsway-d6ac3021ceafdf7e3a876a3764cc553f4df6b8cc.tar.gz
sway-d6ac3021ceafdf7e3a876a3764cc553f4df6b8cc.tar.zst
sway-d6ac3021ceafdf7e3a876a3764cc553f4df6b8cc.zip
Merge pull request #1092 from 4e554c4c/move_floating
i3 feature support: Moving flotaing containers
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/move.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 0b134494..1a8a321e 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -9,30 +9,40 @@
9 9
10struct cmd_results *cmd_move(int argc, char **argv) { 10struct cmd_results *cmd_move(int argc, char **argv) {
11 struct cmd_results *error = NULL; 11 struct cmd_results *error = NULL;
12 int move_amt = 10;
13
12 if (config->reading) return cmd_results_new(CMD_FAILURE, "move", "Can't be used in config file."); 14 if (config->reading) return cmd_results_new(CMD_FAILURE, "move", "Can't be used in config file.");
13 if ((error = checkarg(argc, "move", EXPECTED_AT_LEAST, 1))) { 15 if ((error = checkarg(argc, "move", EXPECTED_AT_LEAST, 1))) {
14 return error; 16 return error;
15 } 17 }
16 const char* expected_syntax = "Expected 'move <left|right|up|down|next|prev|first>' or " 18 const char* expected_syntax = "Expected 'move <left|right|up|down|next|prev|first> <[px] px>' or "
17 "'move <container|window> to workspace <name>' or " 19 "'move <container|window> to workspace <name>' or "
18 "'move <container|window|workspace> to output <name|direction>' or " 20 "'move <container|window|workspace> to output <name|direction>' or "
19 "'move position mouse'"; 21 "'move position mouse'";
20 swayc_t *view = get_focused_container(&root_container); 22 swayc_t *view = get_focused_container(&root_container);
21 23
24 if (argc == 2 || (argc == 3 && strcasecmp(argv[2], "px") == 0 )) {
25 char *inv;
26 move_amt = (int)strtol(argv[1], &inv, 10);
27 if (*inv != '\0' && strcasecmp(inv, "px") != 0) {
28 move_amt = 10;
29 }
30 }
31
22 if (strcasecmp(argv[0], "left") == 0) { 32 if (strcasecmp(argv[0], "left") == 0) {
23 move_container(view, MOVE_LEFT); 33 move_container(view, MOVE_LEFT, move_amt);
24 } else if (strcasecmp(argv[0], "right") == 0) { 34 } else if (strcasecmp(argv[0], "right") == 0) {
25 move_container(view, MOVE_RIGHT); 35 move_container(view, MOVE_RIGHT, move_amt);
26 } else if (strcasecmp(argv[0], "up") == 0) { 36 } else if (strcasecmp(argv[0], "up") == 0) {
27 move_container(view, MOVE_UP); 37 move_container(view, MOVE_UP, move_amt);
28 } else if (strcasecmp(argv[0], "down") == 0) { 38 } else if (strcasecmp(argv[0], "down") == 0) {
29 move_container(view, MOVE_DOWN); 39 move_container(view, MOVE_DOWN, move_amt);
30 } else if (strcasecmp(argv[0], "next") == 0) { 40 } else if (strcasecmp(argv[0], "next") == 0) {
31 move_container(view, MOVE_NEXT); 41 move_container(view, MOVE_NEXT, move_amt);
32 } else if (strcasecmp(argv[0], "prev") == 0) { 42 } else if (strcasecmp(argv[0], "prev") == 0) {
33 move_container(view, MOVE_PREV); 43 move_container(view, MOVE_PREV, move_amt);
34 } else if (strcasecmp(argv[0], "first") == 0) { 44 } else if (strcasecmp(argv[0], "first") == 0) {
35 move_container(view, MOVE_FIRST); 45 move_container(view, MOVE_FIRST, move_amt);
36 } else if (strcasecmp(argv[0], "container") == 0 || strcasecmp(argv[0], "window") == 0) { 46 } else if (strcasecmp(argv[0], "container") == 0 || strcasecmp(argv[0], "window") == 0) {
37 // "move container ... 47 // "move container ...
38 if ((error = checkarg(argc, "move container/window", EXPECTED_AT_LEAST, 4))) { 48 if ((error = checkarg(argc, "move container/window", EXPECTED_AT_LEAST, 4))) {