mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -05:00
Show swaynag on config errors
This commit is contained in:
parent
3e2bf7f3a5
commit
f9a6407111
6 changed files with 118 additions and 20 deletions
12
sway/main.c
12
sway/main.c
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue