diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-08-06 10:43:09 +0100 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-08-06 14:17:58 +0100 |
commit | 667b8dcb67d8c3f15b52f59d228bb3146a5cdb30 (patch) | |
tree | f9873d108bd9c2f934112ea11e322656921a1f70 /sway/commands/workspace.c | |
parent | commands: document <criteria> focus (diff) | |
download | sway-667b8dcb67d8c3f15b52f59d228bb3146a5cdb30.tar.gz sway-667b8dcb67d8c3f15b52f59d228bb3146a5cdb30.tar.zst sway-667b8dcb67d8c3f15b52f59d228bb3146a5cdb30.zip |
commands: check for special workspaces in workspace & move commands
Diffstat (limited to 'sway/commands/workspace.c')
-rw-r--r-- | sway/commands/workspace.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index f32ede1e..f5558bb4 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -68,16 +68,20 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
68 | ws = workspace_create(NULL, name); | 68 | ws = workspace_create(NULL, name); |
69 | free(name); | 69 | free(name); |
70 | } | 70 | } |
71 | } else if (strcasecmp(argv[0], "next") == 0 || | ||
72 | strcasecmp(argv[0], "prev") == 0 || | ||
73 | strcasecmp(argv[0], "next_on_output") == 0 || | ||
74 | strcasecmp(argv[0], "prev_on_output") == 0 || | ||
75 | strcasecmp(argv[0], "current") == 0) { | ||
76 | ws = workspace_by_name(argv[0]); | ||
77 | } else if (strcasecmp(argv[0], "back_and_forth") == 0) { | ||
78 | if (!(ws = workspace_by_name(argv[0])) && prev_workspace_name) { | ||
79 | ws = workspace_create(NULL, prev_workspace_name); | ||
80 | } | ||
71 | } else { | 81 | } else { |
72 | char *name = join_args(argv, argc); | 82 | char *name = join_args(argv, argc); |
73 | if (!(ws = workspace_by_name(name))) { | 83 | if (!(ws = workspace_by_name(name))) { |
74 | if (strcasecmp(argv[0], "back_and_forth") == 0) { | 84 | ws = workspace_create(NULL, name); |
75 | if (prev_workspace_name) { | ||
76 | ws = workspace_create(NULL, prev_workspace_name); | ||
77 | } | ||
78 | } else { | ||
79 | ws = workspace_create(NULL, name); | ||
80 | } | ||
81 | } | 85 | } |
82 | free(name); | 86 | free(name); |
83 | } | 87 | } |