From f26cfd3bb51023cf4c4ff23acd192125ed04881e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sun, 10 Aug 2025 00:22:22 +0200 Subject: [PATCH] wmstatus: don't spam X session logs without MPD Allow and default to setting the MPD address to null. --- wmstatus.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/wmstatus.c b/wmstatus.c index 0c0136e..742bbb2 100644 --- a/wmstatus.c +++ b/wmstatus.c @@ -809,10 +809,10 @@ static const struct config_schema g_config_general[] = static const struct config_schema g_config_mpd[] = { + // XXX: We might want to allow config item defaults to not disable nulls. { .name = "address", .comment = "MPD host or socket", - .type = CONFIG_ITEM_STRING, - .default_ = "\"localhost\"" }, + .type = CONFIG_ITEM_STRING }, { .name = "service", .comment = "MPD service name or port", .type = CONFIG_ITEM_STRING, @@ -1809,8 +1809,12 @@ mpd_on_io_hook (void *user_data, bool outgoing, const char *line) static void on_mpd_reconnect (void *user_data) { - // FIXME: the user should be able to disable MPD struct app_context *ctx = user_data; + struct config_item *root = ctx->config.root; + const char *address = get_config_string (root, "mpd.address"); + const char *service = get_config_string (root, "mpd.service"); + if (!address) + return; struct mpd_client *c = &ctx->mpd_client; c->user_data = ctx; @@ -1820,10 +1824,7 @@ on_mpd_reconnect (void *user_data) c->on_io_hook = mpd_on_io_hook; struct error *e = NULL; - struct config_item *root = ctx->config.root; - if (!mpd_client_connect (&ctx->mpd_client, - get_config_string (root, "mpd.address"), - get_config_string (root, "mpd.service"), &e)) + if (!mpd_client_connect (&ctx->mpd_client, address, service, &e)) { print_error ("%s: %s", "cannot connect to MPD", e->message); error_free (e);