aboutsummaryrefslogtreecommitdiff
path: root/sway/config/output.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-03-30 00:11:00 -0400
committerGitHub <noreply@github.com>2018-03-30 00:11:00 -0400
commit9d7f47746cdcb0eed3cf41875d06a8ef238eef1c (patch)
tree997658454de40db3f8b76b68d658efaf2b686188 /sway/config/output.c
parent7162b9bea4d66d61376ad3605e23e2d83bb95201 (diff)
parentf26ecd9f58bb672fe107660ce9b37f4bf0777a8c (diff)
Merge pull request #1648 from swaywm/swaybar-layers
Port swaybar to layer shell
Diffstat (limited to 'sway/config/output.c')
-rw-r--r--sway/config/output.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index 7fc79739..b4e56efa 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -180,19 +180,20 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
wlr_log(L_DEBUG, "Setting background for output %d to %s",
output_i, oc->background);
- size_t bufsize = 12;
- char output_id[bufsize];
- snprintf(output_id, bufsize, "%d", output_i);
- output_id[bufsize-1] = 0;
-
- char *const cmd[] = {
- "./swaybg/swaybg",
- output_id,
- oc->background,
- oc->background_option,
- NULL,
- };
+ size_t len = snprintf(NULL, 0, "%s %d %s %s",
+ config->swaybg_command ? config->swaybg_command : "swaybg",
+ output_i, oc->background, oc->background_option);
+ char *command = malloc(len + 1);
+ if (!command) {
+ wlr_log(L_DEBUG, "Unable to allocate swaybg command");
+ return;
+ }
+ snprintf(command, len + 1, "%s %d %s %s",
+ config->swaybg_command ? config->swaybg_command : "swaybg",
+ output_i, oc->background, oc->background_option);
+ wlr_log(L_DEBUG, "-> %s", command);
+ char *const cmd[] = { "sh", "-c", command, NULL };
output->sway_output->bg_pid = fork();
if (output->sway_output->bg_pid == 0) {
execvp(cmd[0], cmd);