From 667b8dcb67d8c3f15b52f59d228bb3146a5cdb30 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Mon, 6 Aug 2018 10:43:09 +0100 Subject: commands: check for special workspaces in workspace & move commands --- sway/commands/workspace.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'sway/commands/workspace.c') 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); } -- cgit v1.2.3-54-g00ecf