aboutsummaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/bar/status_command.c2
-rw-r--r--sway/commands/opacity.c4
-rw-r--r--sway/commands/swaybg_command.c15
-rw-r--r--sway/commands/swaynag_command.c15
-rw-r--r--sway/commands/urgent.c3
5 files changed, 29 insertions, 10 deletions
diff --git a/sway/commands/bar/status_command.c b/sway/commands/bar/status_command.c
index 5ea22525..5b4fdc87 100644
--- a/sway/commands/bar/status_command.c
+++ b/sway/commands/bar/status_command.c
@@ -20,6 +20,8 @@ struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
config->current_bar->status_command = new_command;
wlr_log(WLR_DEBUG, "Feeding bar with status command: %s",
config->current_bar->status_command);
+ } else {
+ free(new_command);
}
if (config->active && !config->validating) {
diff --git a/sway/commands/opacity.c b/sway/commands/opacity.c
index 9cdaad7f..4e4fc994 100644
--- a/sway/commands/opacity.c
+++ b/sway/commands/opacity.c
@@ -21,6 +21,10 @@ struct cmd_results *cmd_opacity(int argc, char **argv) {
struct sway_container *con = config->handler_context.container;
+ if (con == NULL) {
+ return cmd_results_new(CMD_FAILURE, "opacity", "No current container");
+ }
+
float opacity = 0.0f;
if (!parse_opacity(argv[0], &opacity)) {
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);
}
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);
}
diff --git a/sway/commands/urgent.c b/sway/commands/urgent.c
index 53c37d4d..4f283c55 100644
--- a/sway/commands/urgent.c
+++ b/sway/commands/urgent.c
@@ -12,6 +12,9 @@ struct cmd_results *cmd_urgent(int argc, char **argv) {
return error;
}
struct sway_container *container = config->handler_context.container;
+ if (!container) {
+ return cmd_results_new(CMD_FAILURE, "urgent", "No current container");
+ }
if (!container->view) {
return cmd_results_new(CMD_INVALID, "urgent",
"Only views can be urgent");