summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sway/commands.c b/sway/commands.c
index ef477f38..a3e6a500 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -98,8 +98,11 @@ static struct cmd_handler handlers[] = {
98 { "client.unfocused", cmd_client_unfocused }, 98 { "client.unfocused", cmd_client_unfocused },
99 { "client.urgent", cmd_client_urgent }, 99 { "client.urgent", cmd_client_urgent },
100 { "default_border", cmd_default_border }, 100 { "default_border", cmd_default_border },
101 { "default_floating_border", cmd_default_floating_border },
101 { "exec", cmd_exec }, 102 { "exec", cmd_exec },
102 { "exec_always", cmd_exec_always }, 103 { "exec_always", cmd_exec_always },
104 { "floating_maximum_size", cmd_floating_maximum_size },
105 { "floating_minimum_size", cmd_floating_minimum_size },
103 { "focus_follows_mouse", cmd_focus_follows_mouse }, 106 { "focus_follows_mouse", cmd_focus_follows_mouse },
104 { "focus_wrapping", cmd_focus_wrapping }, 107 { "focus_wrapping", cmd_focus_wrapping },
105 { "font", cmd_font }, 108 { "font", cmd_font },
@@ -112,6 +115,7 @@ static struct cmd_handler handlers[] = {
112 { "input", cmd_input }, 115 { "input", cmd_input },
113 { "mode", cmd_mode }, 116 { "mode", cmd_mode },
114 { "mouse_warping", cmd_mouse_warping }, 117 { "mouse_warping", cmd_mouse_warping },
118 { "no_focus", cmd_no_focus },
115 { "output", cmd_output }, 119 { "output", cmd_output },
116 { "seat", cmd_seat }, 120 { "seat", cmd_seat },
117 { "set", cmd_set }, 121 { "set", cmd_set },
@@ -151,6 +155,7 @@ static struct cmd_handler command_handlers[] = {
151 { "swap", cmd_swap }, 155 { "swap", cmd_swap },
152 { "title_format", cmd_title_format }, 156 { "title_format", cmd_title_format },
153 { "unmark", cmd_unmark }, 157 { "unmark", cmd_unmark },
158 { "urgent", cmd_urgent },
154}; 159};
155 160
156static int handler_compare(const void *_a, const void *_b) { 161static int handler_compare(const void *_a, const void *_b) {
@@ -163,7 +168,7 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers,
163 int handlers_size) { 168 int handlers_size) {
164 struct cmd_handler d = { .command=line }; 169 struct cmd_handler d = { .command=line };
165 struct cmd_handler *res = NULL; 170 struct cmd_handler *res = NULL;
166 wlr_log(L_DEBUG, "find_handler(%s)", line); 171 wlr_log(WLR_DEBUG, "find_handler(%s)", line);
167 172
168 bool config_loading = config->reading || !config->active; 173 bool config_loading = config->reading || !config->active;
169 174
@@ -248,10 +253,10 @@ struct cmd_results *execute_command(char *_exec, struct sway_seat *seat) {
248 cmd = argsep(&cmdlist, ","); 253 cmd = argsep(&cmdlist, ",");
249 cmd += strspn(cmd, whitespace); 254 cmd += strspn(cmd, whitespace);
250 if (strcmp(cmd, "") == 0) { 255 if (strcmp(cmd, "") == 0) {
251 wlr_log(L_INFO, "Ignoring empty command."); 256 wlr_log(WLR_INFO, "Ignoring empty command.");
252 continue; 257 continue;
253 } 258 }
254 wlr_log(L_INFO, "Handling command '%s'", cmd); 259 wlr_log(WLR_INFO, "Handling command '%s'", cmd);
255 //TODO better handling of argv 260 //TODO better handling of argv
256 int argc; 261 int argc;
257 char **argv = split_args(cmd, &argc); 262 char **argv = split_args(cmd, &argc);
@@ -344,7 +349,7 @@ struct cmd_results *config_command(char *exec) {
344 349
345 // Start block 350 // Start block
346 if (argc > 1 && strcmp(argv[argc - 1], "{") == 0) { 351 if (argc > 1 && strcmp(argv[argc - 1], "{") == 0) {
347 char *block = join_args(argv, argc - 1); 352 char *block = join_args(argv, argc - 1);
348 results = cmd_results_new(CMD_BLOCK, block, NULL); 353 results = cmd_results_new(CMD_BLOCK, block, NULL);
349 free(block); 354 free(block);
350 goto cleanup; 355 goto cleanup;
@@ -355,7 +360,7 @@ struct cmd_results *config_command(char *exec) {
355 results = cmd_results_new(CMD_BLOCK_END, NULL, NULL); 360 results = cmd_results_new(CMD_BLOCK_END, NULL, NULL);
356 goto cleanup; 361 goto cleanup;
357 } 362 }
358 wlr_log(L_INFO, "handling config command '%s'", exec); 363 wlr_log(WLR_INFO, "handling config command '%s'", exec);
359 struct cmd_handler *handler = find_handler(argv[0], NULL, 0); 364 struct cmd_handler *handler = find_handler(argv[0], NULL, 0);
360 if (!handler) { 365 if (!handler) {
361 char *input = argv[0] ? argv[0] : "(empty)"; 366 char *input = argv[0] ? argv[0] : "(empty)";
@@ -388,7 +393,7 @@ cleanup:
388struct cmd_results *config_subcommand(char **argv, int argc, 393struct cmd_results *config_subcommand(char **argv, int argc,
389 struct cmd_handler *handlers, size_t handlers_size) { 394 struct cmd_handler *handlers, size_t handlers_size) {
390 char *command = join_args(argv, argc); 395 char *command = join_args(argv, argc);
391 wlr_log(L_DEBUG, "Subcommand: %s", command); 396 wlr_log(WLR_DEBUG, "Subcommand: %s", command);
392 free(command); 397 free(command);
393 398
394 struct cmd_handler *handler = find_handler(argv[0], handlers, 399 struct cmd_handler *handler = find_handler(argv[0], handlers,
@@ -479,7 +484,7 @@ struct cmd_results *config_commands_command(char *exec) {
479 } 484 }
480 policy->context = context; 485 policy->context = context;
481 486
482 wlr_log(L_INFO, "Set command policy for %s to %d", 487 wlr_log(WLR_INFO, "Set command policy for %s to %d",
483 policy->command, policy->context); 488 policy->command, policy->context);
484 489
485 results = cmd_results_new(CMD_SUCCESS, NULL, NULL); 490 results = cmd_results_new(CMD_SUCCESS, NULL, NULL);
@@ -493,7 +498,7 @@ struct cmd_results *cmd_results_new(enum cmd_status status,
493 const char *input, const char *format, ...) { 498 const char *input, const char *format, ...) {
494 struct cmd_results *results = malloc(sizeof(struct cmd_results)); 499 struct cmd_results *results = malloc(sizeof(struct cmd_results));
495 if (!results) { 500 if (!results) {
496 wlr_log(L_ERROR, "Unable to allocate command results"); 501 wlr_log(WLR_ERROR, "Unable to allocate command results");
497 return NULL; 502 return NULL;
498 } 503 }
499 results->status = status; 504 results->status = status;