diff options
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) { | |||
26 | "mode", "Can only be used in config file."); | 26 | "mode", "Can only be used in config file."); |
27 | } | 27 | } |
28 | 28 | ||
29 | const char *mode_name = argv[0]; | 29 | bool pango = strcmp(*argv, "--pango_markup") == 0; |
30 | if (pango) { | ||
31 | argc--; argv++; | ||
32 | if (argc == 0) { | ||
33 | return cmd_results_new(CMD_FAILURE, "mode", | ||
34 | "Mode name is missing"); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | char *mode_name = *argv; | ||
39 | strip_quotes(mode_name); | ||
30 | struct sway_mode *mode = NULL; | 40 | struct sway_mode *mode = NULL; |
31 | // Find mode | 41 | // Find mode |
32 | for (int i = 0; i < config->modes->length; ++i) { | 42 | for (int i = 0; i < config->modes->length; ++i) { |
@@ -46,6 +56,7 @@ struct cmd_results *cmd_mode(int argc, char **argv) { | |||
46 | mode->name = strdup(mode_name); | 56 | mode->name = strdup(mode_name); |
47 | mode->keysym_bindings = create_list(); | 57 | mode->keysym_bindings = create_list(); |
48 | mode->keycode_bindings = create_list(); | 58 | mode->keycode_bindings = create_list(); |
59 | mode->pango = pango; | ||
49 | list_add(config->modes, mode); | 60 | list_add(config->modes, mode); |
50 | } | 61 | } |
51 | if (!mode) { | 62 | if (!mode) { |
@@ -54,13 +65,15 @@ struct cmd_results *cmd_mode(int argc, char **argv) { | |||
54 | return error; | 65 | return error; |
55 | } | 66 | } |
56 | if ((config->reading && argc > 1) || (!config->reading && argc == 1)) { | 67 | if ((config->reading && argc > 1) || (!config->reading && argc == 1)) { |
57 | wlr_log(L_DEBUG, "Switching to mode `%s'",mode->name); | 68 | wlr_log(L_DEBUG, "Switching to mode `%s' (pango=%d)", |
69 | mode->name, mode->pango); | ||
58 | } | 70 | } |
59 | // Set current mode | 71 | // Set current mode |
60 | config->current_mode = mode; | 72 | config->current_mode = mode; |
61 | if (argc == 1) { | 73 | if (argc == 1) { |
62 | // trigger IPC mode event | 74 | // trigger IPC mode event |
63 | ipc_event_mode(config->current_mode->name); | 75 | ipc_event_mode(config->current_mode->name, |
76 | config->current_mode->pango); | ||
64 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 77 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
65 | } | 78 | } |
66 | 79 | ||