diff options
author | emersion <contact@emersion.fr> | 2018-07-06 16:22:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-06 16:22:13 +0100 |
commit | b3c55dd909b070625c9bfcebcb89cb8463e2ffc9 (patch) | |
tree | 714db24403e159b89cf5eaa59ddbd6cccd033947 /sway/commands | |
parent | 7ef08ffbe6dc9a0b35cd9cad0b689136e3515886 (diff) | |
parent | b8ee88344a5e2869fd3ce04762eda305dc5bf62e (diff) |
Merge branch 'master' into leaks
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/mode.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sway/commands/mode.c b/sway/commands/mode.c index 00331ccc..d2c14468 100644 --- a/sway/commands/mode.c +++ b/sway/commands/mode.c @@ -26,7 +26,17 @@ struct cmd_results *cmd_mode(int argc, char **argv) { "mode", "Can only be used in config file."); } - const char *mode_name = argv[0]; + bool pango = strcmp(*argv, "--pango_markup") == 0; + if (pango) { + argc--; argv++; + if (argc == 0) { + return cmd_results_new(CMD_FAILURE, "mode", + "Mode name is missing"); + } + } + + char *mode_name = *argv; + strip_quotes(mode_name); struct sway_mode *mode = NULL; // Find mode for (int i = 0; i < config->modes->length; ++i) { @@ -46,6 +56,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) { mode->name = strdup(mode_name); mode->keysym_bindings = create_list(); mode->keycode_bindings = create_list(); + mode->pango = pango; list_add(config->modes, mode); } if (!mode) { @@ -54,13 +65,15 @@ struct cmd_results *cmd_mode(int argc, char **argv) { return error; } if ((config->reading && argc > 1) || (!config->reading && argc == 1)) { - wlr_log(L_DEBUG, "Switching to mode `%s'",mode->name); + wlr_log(L_DEBUG, "Switching to mode `%s' (pango=%d)", + mode->name, mode->pango); } // Set current mode config->current_mode = mode; if (argc == 1) { // trigger IPC mode event - ipc_event_mode(config->current_mode->name); + ipc_event_mode(config->current_mode->name, + config->current_mode->pango); return cmd_results_new(CMD_SUCCESS, NULL, NULL); } |