diff options
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/sway/config.c b/sway/config.c index e0a93e19..5ec45b17 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -232,12 +232,12 @@ static char *get_config_path(void) { | |||
232 | char *home = getenv("HOME"); | 232 | char *home = getenv("HOME"); |
233 | char *config_home = malloc(strlen(home) + strlen("/.config") + 1); | 233 | char *config_home = malloc(strlen(home) + strlen("/.config") + 1); |
234 | if (!config_home) { | 234 | if (!config_home) { |
235 | sway_log(L_ERROR, "Unable to allocate $HOME/.config"); | 235 | wlr_log(L_ERROR, "Unable to allocate $HOME/.config"); |
236 | } else { | 236 | } else { |
237 | strcpy(config_home, home); | 237 | strcpy(config_home, home); |
238 | strcat(config_home, "/.config"); | 238 | strcat(config_home, "/.config"); |
239 | setenv("XDG_CONFIG_HOME", config_home, 1); | 239 | setenv("XDG_CONFIG_HOME", config_home, 1); |
240 | sway_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home); | 240 | wlr_log(L_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home); |
241 | free(config_home); | 241 | free(config_home); |
242 | } | 242 | } |
243 | } | 243 | } |
@@ -263,7 +263,7 @@ static char *get_config_path(void) { | |||
263 | const char *current_config_path; | 263 | const char *current_config_path; |
264 | 264 | ||
265 | static bool load_config(const char *path, struct sway_config *config) { | 265 | static bool load_config(const char *path, struct sway_config *config) { |
266 | sway_log(L_INFO, "Loading config from %s", path); | 266 | wlr_log(L_INFO, "Loading config from %s", path); |
267 | current_config_path = path; | 267 | current_config_path = path; |
268 | 268 | ||
269 | struct stat sb; | 269 | struct stat sb; |
@@ -272,13 +272,13 @@ static bool load_config(const char *path, struct sway_config *config) { | |||
272 | } | 272 | } |
273 | 273 | ||
274 | if (path == NULL) { | 274 | if (path == NULL) { |
275 | sway_log(L_ERROR, "Unable to find a config file!"); | 275 | wlr_log(L_ERROR, "Unable to find a config file!"); |
276 | return false; | 276 | return false; |
277 | } | 277 | } |
278 | 278 | ||
279 | FILE *f = fopen(path, "r"); | 279 | FILE *f = fopen(path, "r"); |
280 | if (!f) { | 280 | if (!f) { |
281 | sway_log(L_ERROR, "Unable to open %s for reading", path); | 281 | wlr_log(L_ERROR, "Unable to open %s for reading", path); |
282 | return false; | 282 | return false; |
283 | } | 283 | } |
284 | 284 | ||
@@ -286,7 +286,7 @@ static bool load_config(const char *path, struct sway_config *config) { | |||
286 | fclose(f); | 286 | fclose(f); |
287 | 287 | ||
288 | if (!config_load_success) { | 288 | if (!config_load_success) { |
289 | sway_log(L_ERROR, "Error(s) loading config!"); | 289 | wlr_log(L_ERROR, "Error(s) loading config!"); |
290 | } | 290 | } |
291 | 291 | ||
292 | current_config_path = NULL; | 292 | current_config_path = NULL; |
@@ -313,7 +313,7 @@ bool load_main_config(const char *file, bool is_active) { | |||
313 | 313 | ||
314 | config_defaults(config); | 314 | config_defaults(config); |
315 | if (is_active) { | 315 | if (is_active) { |
316 | sway_log(L_DEBUG, "Performing configuration file reload"); | 316 | wlr_log(L_DEBUG, "Performing configuration file reload"); |
317 | config->reloading = true; | 317 | config->reloading = true; |
318 | config->active = true; | 318 | config->active = true; |
319 | } | 319 | } |
@@ -327,7 +327,7 @@ bool load_main_config(const char *file, bool is_active) { | |||
327 | bool success = true; | 327 | bool success = true; |
328 | DIR *dir = opendir(SYSCONFDIR "/sway/security.d"); | 328 | DIR *dir = opendir(SYSCONFDIR "/sway/security.d"); |
329 | if (!dir) { | 329 | if (!dir) { |
330 | sway_log(L_ERROR, | 330 | wlr_log(L_ERROR, |
331 | "%s does not exist, sway will have no security configuration" | 331 | "%s does not exist, sway will have no security configuration" |
332 | " and will probably be broken", SYSCONFDIR "/sway/security.d"); | 332 | " and will probably be broken", SYSCONFDIR "/sway/security.d"); |
333 | } else { | 333 | } else { |
@@ -356,7 +356,7 @@ bool load_main_config(const char *file, bool is_active) { | |||
356 | if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 || | 356 | if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 || |
357 | (((s.st_mode & 0777) != 0644) && | 357 | (((s.st_mode & 0777) != 0644) && |
358 | (s.st_mode & 0777) != 0444)) { | 358 | (s.st_mode & 0777) != 0444)) { |
359 | sway_log(L_ERROR, | 359 | wlr_log(L_ERROR, |
360 | "Refusing to load %s - it must be owned by root " | 360 | "Refusing to load %s - it must be owned by root " |
361 | "and mode 644 or 444", _path); | 361 | "and mode 644 or 444", _path); |
362 | success = false; | 362 | success = false; |
@@ -398,7 +398,7 @@ static bool load_include_config(const char *path, const char *parent_dir, | |||
398 | len = len + strlen(parent_dir) + 2; | 398 | len = len + strlen(parent_dir) + 2; |
399 | full_path = malloc(len * sizeof(char)); | 399 | full_path = malloc(len * sizeof(char)); |
400 | if (!full_path) { | 400 | if (!full_path) { |
401 | sway_log(L_ERROR, | 401 | wlr_log(L_ERROR, |
402 | "Unable to allocate full path to included config"); | 402 | "Unable to allocate full path to included config"); |
403 | return false; | 403 | return false; |
404 | } | 404 | } |
@@ -409,7 +409,7 @@ static bool load_include_config(const char *path, const char *parent_dir, | |||
409 | free(full_path); | 409 | free(full_path); |
410 | 410 | ||
411 | if (real_path == NULL) { | 411 | if (real_path == NULL) { |
412 | sway_log(L_DEBUG, "%s not found.", path); | 412 | wlr_log(L_DEBUG, "%s not found.", path); |
413 | return false; | 413 | return false; |
414 | } | 414 | } |
415 | 415 | ||
@@ -418,7 +418,7 @@ static bool load_include_config(const char *path, const char *parent_dir, | |||
418 | for (j = 0; j < config->config_chain->length; ++j) { | 418 | for (j = 0; j < config->config_chain->length; ++j) { |
419 | char *old_path = config->config_chain->items[j]; | 419 | char *old_path = config->config_chain->items[j]; |
420 | if (strcmp(real_path, old_path) == 0) { | 420 | if (strcmp(real_path, old_path) == 0) { |
421 | sway_log(L_DEBUG, | 421 | wlr_log(L_DEBUG, |
422 | "%s already included once, won't be included again.", | 422 | "%s already included once, won't be included again.", |
423 | real_path); | 423 | real_path); |
424 | free(real_path); | 424 | free(real_path); |
@@ -472,7 +472,7 @@ bool load_include_configs(const char *path, struct sway_config *config) { | |||
472 | // restore wd | 472 | // restore wd |
473 | if (chdir(wd) < 0) { | 473 | if (chdir(wd) < 0) { |
474 | free(wd); | 474 | free(wd); |
475 | sway_log(L_ERROR, "failed to restore working directory"); | 475 | wlr_log(L_ERROR, "failed to restore working directory"); |
476 | return false; | 476 | return false; |
477 | } | 477 | } |
478 | 478 | ||
@@ -508,13 +508,13 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
508 | switch(res->status) { | 508 | switch(res->status) { |
509 | case CMD_FAILURE: | 509 | case CMD_FAILURE: |
510 | case CMD_INVALID: | 510 | case CMD_INVALID: |
511 | sway_log(L_ERROR, "Error on line %i '%s': %s (%s)", line_number, | 511 | wlr_log(L_ERROR, "Error on line %i '%s': %s (%s)", line_number, |
512 | line, res->error, config->current_config); | 512 | line, res->error, config->current_config); |
513 | success = false; | 513 | success = false; |
514 | break; | 514 | break; |
515 | 515 | ||
516 | case CMD_DEFER: | 516 | case CMD_DEFER: |
517 | sway_log(L_DEBUG, "Deferring command `%s'", line); | 517 | wlr_log(L_DEBUG, "Deferring command `%s'", line); |
518 | list_add(config->cmd_queue, strdup(line)); | 518 | list_add(config->cmd_queue, strdup(line)); |
519 | break; | 519 | break; |
520 | 520 | ||
@@ -522,7 +522,7 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
522 | if (block == CMD_BLOCK_END) { | 522 | if (block == CMD_BLOCK_END) { |
523 | block = CMD_BLOCK_MODE; | 523 | block = CMD_BLOCK_MODE; |
524 | } else { | 524 | } else { |
525 | sway_log(L_ERROR, "Invalid block '%s'", line); | 525 | wlr_log(L_ERROR, "Invalid block '%s'", line); |
526 | } | 526 | } |
527 | break; | 527 | break; |
528 | 528 | ||
@@ -530,7 +530,7 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
530 | if (block == CMD_BLOCK_END) { | 530 | if (block == CMD_BLOCK_END) { |
531 | block = CMD_BLOCK_INPUT; | 531 | block = CMD_BLOCK_INPUT; |
532 | } else { | 532 | } else { |
533 | sway_log(L_ERROR, "Invalid block '%s'", line); | 533 | wlr_log(L_ERROR, "Invalid block '%s'", line); |
534 | } | 534 | } |
535 | break; | 535 | break; |
536 | 536 | ||
@@ -538,7 +538,7 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
538 | if (block == CMD_BLOCK_END) { | 538 | if (block == CMD_BLOCK_END) { |
539 | block = CMD_BLOCK_SEAT; | 539 | block = CMD_BLOCK_SEAT; |
540 | } else { | 540 | } else { |
541 | sway_log(L_ERROR, "Invalid block '%s'", line); | 541 | wlr_log(L_ERROR, "Invalid block '%s'", line); |
542 | } | 542 | } |
543 | break; | 543 | break; |
544 | 544 | ||
@@ -546,7 +546,7 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
546 | if (block == CMD_BLOCK_END) { | 546 | if (block == CMD_BLOCK_END) { |
547 | block = CMD_BLOCK_BAR; | 547 | block = CMD_BLOCK_BAR; |
548 | } else { | 548 | } else { |
549 | sway_log(L_ERROR, "Invalid block '%s'", line); | 549 | wlr_log(L_ERROR, "Invalid block '%s'", line); |
550 | } | 550 | } |
551 | break; | 551 | break; |
552 | 552 | ||
@@ -554,7 +554,7 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
554 | if (block == CMD_BLOCK_BAR) { | 554 | if (block == CMD_BLOCK_BAR) { |
555 | block = CMD_BLOCK_BAR_COLORS; | 555 | block = CMD_BLOCK_BAR_COLORS; |
556 | } else { | 556 | } else { |
557 | sway_log(L_ERROR, "Invalid block '%s'", line); | 557 | wlr_log(L_ERROR, "Invalid block '%s'", line); |
558 | } | 558 | } |
559 | break; | 559 | break; |
560 | 560 | ||
@@ -562,7 +562,7 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
562 | if (block == CMD_BLOCK_END) { | 562 | if (block == CMD_BLOCK_END) { |
563 | block = CMD_BLOCK_COMMANDS; | 563 | block = CMD_BLOCK_COMMANDS; |
564 | } else { | 564 | } else { |
565 | sway_log(L_ERROR, "Invalid block '%s'", line); | 565 | wlr_log(L_ERROR, "Invalid block '%s'", line); |
566 | } | 566 | } |
567 | break; | 567 | break; |
568 | 568 | ||
@@ -570,7 +570,7 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
570 | if (block == CMD_BLOCK_END) { | 570 | if (block == CMD_BLOCK_END) { |
571 | block = CMD_BLOCK_IPC; | 571 | block = CMD_BLOCK_IPC; |
572 | } else { | 572 | } else { |
573 | sway_log(L_ERROR, "Invalid block '%s'", line); | 573 | wlr_log(L_ERROR, "Invalid block '%s'", line); |
574 | } | 574 | } |
575 | break; | 575 | break; |
576 | 576 | ||
@@ -578,59 +578,59 @@ bool read_config(FILE *file, struct sway_config *config) { | |||
578 | if (block == CMD_BLOCK_IPC) { | 578 | if (block == CMD_BLOCK_IPC) { |
579 | block = CMD_BLOCK_IPC_EVENTS; | 579 | block = CMD_BLOCK_IPC_EVENTS; |
580 | } else { | 580 | } else { |
581 | sway_log(L_ERROR, "Invalid block '%s'", line); | 581 | wlr_log(L_ERROR, "Invalid block '%s'", line); |
582 | } | 582 | } |
583 | break; | 583 | break; |
584 | 584 | ||
585 | case CMD_BLOCK_END: | 585 | case CMD_BLOCK_END: |
586 | switch(block) { | 586 | switch(block) { |
587 | case CMD_BLOCK_MODE: | 587 | case CMD_BLOCK_MODE: |
588 | sway_log(L_DEBUG, "End of mode block"); | 588 | wlr_log(L_DEBUG, "End of mode block"); |
589 | config->current_mode = config->modes->items[0]; | 589 | config->current_mode = config->modes->items[0]; |
590 | block = CMD_BLOCK_END; | 590 | block = CMD_BLOCK_END; |
591 | break; | 591 | break; |
592 | 592 | ||
593 | case CMD_BLOCK_INPUT: | 593 | case CMD_BLOCK_INPUT: |
594 | sway_log(L_DEBUG, "End of input block"); | 594 | wlr_log(L_DEBUG, "End of input block"); |
595 | free_input_config(current_input_config); | 595 | free_input_config(current_input_config); |
596 | current_input_config = NULL; | 596 | current_input_config = NULL; |
597 | block = CMD_BLOCK_END; | 597 | block = CMD_BLOCK_END; |
598 | break; | 598 | break; |
599 | 599 | ||
600 | case CMD_BLOCK_SEAT: | 600 | case CMD_BLOCK_SEAT: |
601 | sway_log(L_DEBUG, "End of seat block"); | 601 | wlr_log(L_DEBUG, "End of seat block"); |
602 | current_seat_config = NULL; | 602 | current_seat_config = NULL; |
603 | block = CMD_BLOCK_END; | 603 | block = CMD_BLOCK_END; |
604 | break; | 604 | break; |
605 | 605 | ||
606 | case CMD_BLOCK_BAR: | 606 | case CMD_BLOCK_BAR: |
607 | sway_log(L_DEBUG, "End of bar block"); | 607 | wlr_log(L_DEBUG, "End of bar block"); |
608 | config->current_bar = NULL; | 608 | config->current_bar = NULL; |
609 | block = CMD_BLOCK_END; | 609 | block = CMD_BLOCK_END; |
610 | break; | 610 | break; |
611 | 611 | ||
612 | case CMD_BLOCK_BAR_COLORS: | 612 | case CMD_BLOCK_BAR_COLORS: |
613 | sway_log(L_DEBUG, "End of bar colors block"); | 613 | wlr_log(L_DEBUG, "End of bar colors block"); |
614 | block = CMD_BLOCK_BAR; | 614 | block = CMD_BLOCK_BAR; |
615 | break; | 615 | break; |
616 | 616 | ||
617 | case CMD_BLOCK_COMMANDS: | 617 | case CMD_BLOCK_COMMANDS: |
618 | sway_log(L_DEBUG, "End of commands block"); | 618 | wlr_log(L_DEBUG, "End of commands block"); |
619 | block = CMD_BLOCK_END; | 619 | block = CMD_BLOCK_END; |
620 | break; | 620 | break; |
621 | 621 | ||
622 | case CMD_BLOCK_IPC: | 622 | case CMD_BLOCK_IPC: |
623 | sway_log(L_DEBUG, "End of IPC block"); | 623 | wlr_log(L_DEBUG, "End of IPC block"); |
624 | block = CMD_BLOCK_END; | 624 | block = CMD_BLOCK_END; |
625 | break; | 625 | break; |
626 | 626 | ||
627 | case CMD_BLOCK_IPC_EVENTS: | 627 | case CMD_BLOCK_IPC_EVENTS: |
628 | sway_log(L_DEBUG, "End of IPC events block"); | 628 | wlr_log(L_DEBUG, "End of IPC events block"); |
629 | block = CMD_BLOCK_IPC; | 629 | block = CMD_BLOCK_IPC; |
630 | break; | 630 | break; |
631 | 631 | ||
632 | case CMD_BLOCK_END: | 632 | case CMD_BLOCK_END: |
633 | sway_log(L_ERROR, "Unmatched }"); | 633 | wlr_log(L_ERROR, "Unmatched }"); |
634 | break; | 634 | break; |
635 | 635 | ||
636 | default:; | 636 | default:; |
@@ -663,7 +663,7 @@ char *do_var_replacement(char *str) { | |||
663 | int vvlen = strlen(var->value); | 663 | int vvlen = strlen(var->value); |
664 | char *newstr = malloc(strlen(str) - vnlen + vvlen + 1); | 664 | char *newstr = malloc(strlen(str) - vnlen + vvlen + 1); |
665 | if (!newstr) { | 665 | if (!newstr) { |
666 | sway_log(L_ERROR, | 666 | wlr_log(L_ERROR, |
667 | "Unable to allocate replacement " | 667 | "Unable to allocate replacement " |
668 | "during variable expansion"); | 668 | "during variable expansion"); |
669 | break; | 669 | break; |