mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -05:00
Write to swaynag pipe fd directly on config errors
This commit is contained in:
parent
f9a6407111
commit
a7f7d4a488
12 changed files with 227 additions and 110 deletions
15
sway/main.c
15
sway/main.c
|
|
@ -22,6 +22,7 @@
|
|||
#include "sway/debug.h"
|
||||
#include "sway/desktop/transaction.h"
|
||||
#include "sway/server.h"
|
||||
#include "sway/swaynag.h"
|
||||
#include "sway/tree/layout.h"
|
||||
#include "sway/ipc-server.h"
|
||||
#include "ipc-client.h"
|
||||
|
|
@ -415,14 +416,13 @@ int main(int argc, char **argv) {
|
|||
ipc_init(&server);
|
||||
log_env();
|
||||
|
||||
char *errors = NULL;
|
||||
if (validate) {
|
||||
bool valid = load_main_config(config_path, false, &errors);
|
||||
free(errors);
|
||||
bool valid = load_main_config(config_path, false, true);
|
||||
return valid ? 0 : 1;
|
||||
}
|
||||
|
||||
if (!load_main_config(config_path, false, &errors)) {
|
||||
setenv("WAYLAND_DISPLAY", server.socket, true);
|
||||
if (!load_main_config(config_path, false, false)) {
|
||||
sway_terminate(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -432,10 +432,8 @@ int main(int argc, char **argv) {
|
|||
|
||||
security_sanity_check();
|
||||
|
||||
setenv("WAYLAND_DISPLAY", server.socket, true);
|
||||
if (!terminate_request) {
|
||||
if (!server_start_backend(&server)) {
|
||||
free(errors);
|
||||
sway_terminate(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
@ -455,9 +453,8 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
transaction_commit_dirty();
|
||||
|
||||
if (errors) {
|
||||
spawn_swaynag_config_errors(config, errors);
|
||||
free(errors);
|
||||
if (config->swaynag_config_errors.pid > 0) {
|
||||
swaynag_show(&config->swaynag_config_errors);
|
||||
}
|
||||
|
||||
if (!terminate_request) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue