From c988b03d85e4c747194a682a40ab1b1e309a2fbe Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 8 Oct 2018 15:08:33 +0200 Subject: Allow swaybg to be disabled Same as #2791 but for swaybg. Fixes #2790 --- sway/commands/swaybg_command.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'sway/commands/swaybg_command.c') diff --git a/sway/commands/swaybg_command.c b/sway/commands/swaybg_command.c index 36f7fdcd..b184b193 100644 --- a/sway/commands/swaybg_command.c +++ b/sway/commands/swaybg_command.c @@ -9,12 +9,17 @@ struct cmd_results *cmd_swaybg_command(int argc, char **argv) { return error; } - if (config->swaybg_command) { - free(config->swaybg_command); + free(config->swaybg_command); + config->swaybg_command = NULL; + + char *new_command = join_args(argv, argc); + if (strcmp(new_command, "-") != 0) { + config->swaybg_command = new_command; + wlr_log(WLR_DEBUG, "Using custom swaybg command: %s", + config->swaybg_command); + } else { + free(new_command); } - config->swaybg_command = join_args(argv, argc); - wlr_log(WLR_DEBUG, "Using custom swaybg command: %s", - config->swaybg_command); return cmd_results_new(CMD_SUCCESS, NULL, NULL); } -- cgit v1.2.3