diff options
author | Ian Fan <[email protected]> | 2018-08-06 10:43:09 +0100 |
---|---|---|
committer | Ian Fan <[email protected]> | 2018-08-06 14:17:58 +0100 |
commit | 667b8dcb67d8c3f15b52f59d228bb3146a5cdb30 (patch) | |
tree | f9873d108bd9c2f934112ea11e322656921a1f70 /sway/commands/workspace.c | |
parent | 3b1f58e1353f68ea10a3c5325ba4e04fbbe0c6a7 (diff) |
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) { ws = workspace_create(NULL, name); free(name); } + } else if (strcasecmp(argv[0], "next") == 0 || + strcasecmp(argv[0], "prev") == 0 || + strcasecmp(argv[0], "next_on_output") == 0 || + strcasecmp(argv[0], "prev_on_output") == 0 || + strcasecmp(argv[0], "current") == 0) { + ws = workspace_by_name(argv[0]); + } else if (strcasecmp(argv[0], "back_and_forth") == 0) { + if (!(ws = workspace_by_name(argv[0])) && prev_workspace_name) { + ws = workspace_create(NULL, prev_workspace_name); + } } else { char *name = join_args(argv, argc); if (!(ws = workspace_by_name(name))) { - if (strcasecmp(argv[0], "back_and_forth") == 0) { - if (prev_workspace_name) { - ws = workspace_create(NULL, prev_workspace_name); - } - } else { - ws = workspace_create(NULL, name); - } + ws = workspace_create(NULL, name); } free(name); } |