Show swaynag on config errors

This commit is contained in:
Brian Ashworth 2018-08-01 23:54:40 -04:00
parent 3e2bf7f3a5
commit f9a6407111
6 changed files with 118 additions and 20 deletions

View file

@ -415,12 +415,14 @@ int main(int argc, char **argv) {
ipc_init(&server);
log_env();
char *errors = NULL;
if (validate) {
bool valid = load_main_config(config_path, false);
bool valid = load_main_config(config_path, false, &errors);
free(errors);
return valid ? 0 : 1;
}
if (!load_main_config(config_path, false)) {
if (!load_main_config(config_path, false, &errors)) {
sway_terminate(EXIT_FAILURE);
}
@ -433,6 +435,7 @@ int main(int argc, char **argv) {
setenv("WAYLAND_DISPLAY", server.socket, true);
if (!terminate_request) {
if (!server_start_backend(&server)) {
free(errors);
sway_terminate(EXIT_FAILURE);
}
}
@ -452,6 +455,11 @@ int main(int argc, char **argv) {
}
transaction_commit_dirty();
if (errors) {
spawn_swaynag_config_errors(config, errors);
free(errors);
}
if (!terminate_request) {
server_run(&server);
}