add logger for config errors and <core><errorCommand> to display it.

This commit is contained in:
elviosak 2026-05-14 06:21:21 -03:00
parent 477b3b1ddb
commit 4efb63f7da
10 changed files with 233 additions and 11 deletions

21
include/common/log.h Normal file
View file

@ -0,0 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_LOG_H
#define LABWC_LOG_H
#include <wlr/util/log.h>
#include "common/buf.h"
struct buf *log_get_buf(void);
void log_set_error(enum wlr_log_importance importance);
void log_reset(void);
void nag_show(void);
void nag_show_callback(void *data);
#define nag_log(verb, fmt, ...) \
do { \
wlr_log(verb, fmt, ##__VA_ARGS__); \
log_set_error(verb); \
buf_add_fmt(log_get_buf(), fmt "\n", ##__VA_ARGS__); \
} while (0)
#endif /* LABWC_LOG_H */

View file

@ -22,6 +22,19 @@ void spawn_async_no_shell(char const *command);
*/
void spawn_sync_no_shell(char const *command);
/**
* spawn_piped_async_no_shell - execute asynchronously
* @command: command to be executed
* @pipe_fd_w: set to the write end of a pipe
* connected to stdin of the command
* Notes:
* The returned pid_t has to be waited for to
* not produce zombies and the pipe_fd_w has to
* be closed. spawn_piped_close() can be used
* to ensure both.
*/
pid_t spawn_piped_async_no_shell(const char *command, int *pipe_fd_w);
/**
* spawn_piped - execute asynchronously
* @command: command to be executed