From fe2ec8a676ddabc52e0a2ac360fd8e07e6546f6b Mon Sep 17 00:00:00 2001 From: Luminarys Date: Sun, 30 Aug 2015 19:59:14 -0500 Subject: Added in workspace back_and_forth --- sway/commands.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index 9a90fe5f..caf8d928 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -800,26 +800,37 @@ static bool cmd_workspace(struct sway_config *config, int argc, char **argv) { if (argc == 1) { // Handle workspace next/prev - if (strcmp(argv[0], "next") == 0) { + if (strcasecmp(argv[0], "next") == 0) { workspace_switch(workspace_next()); return true; } - if (strcmp(argv[0], "prev") == 0) { + if (strcasecmp(argv[0], "prev") == 0) { workspace_switch(workspace_prev()); return true; } // Handle workspace output_next/prev - if (strcmp(argv[0], "next_on_output") == 0) { + if (strcasecmp(argv[0], "next_on_output") == 0) { workspace_switch(workspace_output_next()); return true; } - if (strcmp(argv[0], "prev_on_output") == 0) { + if (strcasecmp(argv[0], "prev_on_output") == 0) { workspace_switch(workspace_output_prev()); return true; } + if (strcasecmp(argv[0], "back_and_forth") == 0) { + if (prev_workspace_name) { + sway_log(L_INFO, "Trying to switch to WS wtih name %s", prev_workspace_name); + if (workspace_by_name(prev_workspace_name)) { + workspace_switch(workspace_by_name(prev_workspace_name)); + } else { + workspace_switch(workspace_create(prev_workspace_name)); + } + } + return true; + } swayc_t *workspace = workspace_by_name(argv[0]); if (!workspace) { -- cgit v1.2.3 From 23f040133d93ae6d1bf1dc328e3f67f43fa3aeef Mon Sep 17 00:00:00 2001 From: Luminarys Date: Sun, 30 Aug 2015 20:02:31 -0500 Subject: Removed unnecessary debug line --- sway/commands.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sway/commands.c') diff --git a/sway/commands.c b/sway/commands.c index caf8d928..1825be4f 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -822,7 +822,6 @@ static bool cmd_workspace(struct sway_config *config, int argc, char **argv) { } if (strcasecmp(argv[0], "back_and_forth") == 0) { if (prev_workspace_name) { - sway_log(L_INFO, "Trying to switch to WS wtih name %s", prev_workspace_name); if (workspace_by_name(prev_workspace_name)) { workspace_switch(workspace_by_name(prev_workspace_name)); } else { -- cgit v1.2.3