summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-08-26 22:58:01 -0400
committerDrew DeVault <sir@cmpwn.com>2019-08-27 13:46:18 +0900
commita8cb63e3a4f7b63be5a54213ae3db6681b7ec4ed (patch)
treed11b3701310775eec495839ca0657f31f6005c34
parentb6e3045d328a6f18c445f006e3dfb3cd60bd1df8 (diff)
cmd_mode: don't reset to default after subcommand
In cmd_mode, the mode is currently being reset to the default mode after a mode subcommand handler is executed. This stores and restores the mode instead
-rw-r--r--sway/commands/mode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sway/commands/mode.c b/sway/commands/mode.c
index 9ddb00892..a5871dabe 100644
--- a/sway/commands/mode.c
+++ b/sway/commands/mode.c
@@ -67,6 +67,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) {
return error;
}
// Set current mode
+ struct sway_mode *stored_mode = config->current_mode;
config->current_mode = mode;
if (argc == 1) {
// trigger IPC mode event
@@ -80,7 +81,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) {
// Create binding
struct cmd_results *result = config_subcommand(argv + 1, argc - 1,
mode_handlers, sizeof(mode_handlers));
- config->current_mode = config->modes->items[0];
+ config->current_mode = stored_mode;
return result;
}