diff options
author | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-01-11 03:13:36 +0100 |
---|---|---|
committer | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-01-11 03:13:36 +0100 |
commit | 222f0d44fcda494dca4d5278493a3082068743de (patch) | |
tree | b49ff12800562bd4fa12e4e4e08b8c75d89b43c9 | |
parent | Merge pull request #443 from mikkeloscar/binding-event-input_code (diff) | |
download | sway-222f0d44fcda494dca4d5278493a3082068743de.tar.gz sway-222f0d44fcda494dca4d5278493a3082068743de.tar.zst sway-222f0d44fcda494dca4d5278493a3082068743de.zip |
Strip quotes from workspace name.
Fix #444
This is a temporary fix, the real fix is to store the commands as a
formatted argv array, so they don't have to be reformatted all over the
place.
-rw-r--r-- | sway/commands.c | 8 | ||||
-rw-r--r-- | sway/workspace.c | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/sway/commands.c b/sway/commands.c index 0025fcb1..d5ffb519 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -717,11 +717,14 @@ static struct cmd_results *cmd_move(int argc, char **argv) { | |||
717 | return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); | 717 | return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); |
718 | } | 718 | } |
719 | 719 | ||
720 | const char *ws_name = argv[3]; | 720 | char *ws_name = strdup(argv[3]); |
721 | strip_quotes(ws_name); | ||
721 | swayc_t *ws; | 722 | swayc_t *ws; |
722 | if (argc == 5 && strcasecmp(ws_name, "number") == 0) { | 723 | if (argc == 5 && strcasecmp(ws_name, "number") == 0) { |
723 | // move "container to workspace number x" | 724 | // move "container to workspace number x" |
724 | ws_name = argv[4]; | 725 | free(ws_name); |
726 | ws_name = strdup(argv[4]); | ||
727 | strip_quotes(ws_name); | ||
725 | ws = workspace_by_number(ws_name); | 728 | ws = workspace_by_number(ws_name); |
726 | } else { | 729 | } else { |
727 | ws = workspace_by_name(ws_name); | 730 | ws = workspace_by_name(ws_name); |
@@ -730,6 +733,7 @@ static struct cmd_results *cmd_move(int argc, char **argv) { | |||
730 | if (ws == NULL) { | 733 | if (ws == NULL) { |
731 | ws = workspace_create(ws_name); | 734 | ws = workspace_create(ws_name); |
732 | } | 735 | } |
736 | free(ws_name); | ||
733 | move_container_to(view, get_focused_container(ws)); | 737 | move_container_to(view, get_focused_container(ws)); |
734 | } else if (strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "output") == 0) { | 738 | } else if (strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "output") == 0) { |
735 | // move container to output x | 739 | // move container to output x |
diff --git a/sway/workspace.c b/sway/workspace.c index f7523b79..ad989de9 100644 --- a/sway/workspace.c +++ b/sway/workspace.c | |||
@@ -50,6 +50,7 @@ char *workspace_next_name(void) { | |||
50 | if (strcmp("workspace", cmd) == 0 && name) { | 50 | if (strcmp("workspace", cmd) == 0 && name) { |
51 | sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", name); | 51 | sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", name); |
52 | char *_target = strdup(name); | 52 | char *_target = strdup(name); |
53 | strip_quotes(_target); | ||
53 | while (isspace(*_target)) | 54 | while (isspace(*_target)) |
54 | _target++; | 55 | _target++; |
55 | 56 | ||