aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-02 21:37:29 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-03 10:37:35 -0400
commita7f7d4a488c8d3b2461122765f9904c8a411a583 (patch)
tree7abee51265a8b9550c62255d0c6649935ee1d6a2 /sway/main.c
parentShow swaynag on config errors (diff)
downloadsway-a7f7d4a488c8d3b2461122765f9904c8a411a583.tar.gz
sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.tar.zst
sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.zip
Write to swaynag pipe fd directly on config errors
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sway/main.c b/sway/main.c
index de2445a8..c02caf42 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -22,6 +22,7 @@
22#include "sway/debug.h" 22#include "sway/debug.h"
23#include "sway/desktop/transaction.h" 23#include "sway/desktop/transaction.h"
24#include "sway/server.h" 24#include "sway/server.h"
25#include "sway/swaynag.h"
25#include "sway/tree/layout.h" 26#include "sway/tree/layout.h"
26#include "sway/ipc-server.h" 27#include "sway/ipc-server.h"
27#include "ipc-client.h" 28#include "ipc-client.h"
@@ -415,14 +416,13 @@ int main(int argc, char **argv) {
415 ipc_init(&server); 416 ipc_init(&server);
416 log_env(); 417 log_env();
417 418
418 char *errors = NULL;
419 if (validate) { 419 if (validate) {
420 bool valid = load_main_config(config_path, false, &errors); 420 bool valid = load_main_config(config_path, false, true);
421 free(errors);
422 return valid ? 0 : 1; 421 return valid ? 0 : 1;
423 } 422 }
424 423
425 if (!load_main_config(config_path, false, &errors)) { 424 setenv("WAYLAND_DISPLAY", server.socket, true);
425 if (!load_main_config(config_path, false, false)) {
426 sway_terminate(EXIT_FAILURE); 426 sway_terminate(EXIT_FAILURE);
427 } 427 }
428 428
@@ -432,10 +432,8 @@ int main(int argc, char **argv) {
432 432
433 security_sanity_check(); 433 security_sanity_check();
434 434
435 setenv("WAYLAND_DISPLAY", server.socket, true);
436 if (!terminate_request) { 435 if (!terminate_request) {
437 if (!server_start_backend(&server)) { 436 if (!server_start_backend(&server)) {
438 free(errors);
439 sway_terminate(EXIT_FAILURE); 437 sway_terminate(EXIT_FAILURE);
440 } 438 }
441 } 439 }
@@ -455,9 +453,8 @@ int main(int argc, char **argv) {
455 } 453 }
456 transaction_commit_dirty(); 454 transaction_commit_dirty();
457 455
458 if (errors) { 456 if (config->swaynag_config_errors.pid > 0) {
459 spawn_swaynag_config_errors(config, errors); 457 swaynag_show(&config->swaynag_config_errors);
460 free(errors);
461 } 458 }
462 459
463 if (!terminate_request) { 460 if (!terminate_request) {