aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/swaynag_command.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/swaynag_command.c')
-rw-r--r--sway/commands/swaynag_command.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sway/commands/swaynag_command.c b/sway/commands/swaynag_command.c
index c57a80a6..6c86f1a7 100644
--- a/sway/commands/swaynag_command.c
+++ b/sway/commands/swaynag_command.c
@@ -9,12 +9,17 @@ struct cmd_results *cmd_swaynag_command(int argc, char **argv) {
return error;
}
- if (config->swaynag_command) {
- free(config->swaynag_command);
+ free(config->swaynag_command);
+ config->swaynag_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 swaynag command: %s",
+ config->swaynag_command);
+ } else {
+ free(new_command);
}
- config->swaynag_command = join_args(argv, argc);
- wlr_log(WLR_DEBUG, "Using custom swaynag command: %s",
- config->swaynag_command);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}