aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/swaybg_command.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-10-08 15:50:56 +0200
committerGitHub <noreply@github.com>2018-10-08 15:50:56 +0200
commit45f2cd0c73cb21bea6ae27bd396cd3721f3cd41a (patch)
tree8fdc0a2cf97e16d129c893841a32081903804a98 /sway/commands/swaybg_command.c
parent1c1fbd49db9a493af8101792ceede5f035724a6d (diff)
parentab3a397d58898045c3461bbdca8f48361ccfb8f4 (diff)
Merge pull request #2793 from emersion/disable-swaybg
Allow swaybg to be disabled
Diffstat (limited to 'sway/commands/swaybg_command.c')
-rw-r--r--sway/commands/swaybg_command.c15
1 files changed, 10 insertions, 5 deletions
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);
}