diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands/output/background.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c index ae2f0640..00038e67 100644 --- a/sway/commands/output/background.c +++ b/sway/commands/output/background.c | |||
@@ -34,8 +34,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { | |||
34 | struct output_config *output = config->handler_context.output_config; | 34 | struct output_config *output = config->handler_context.output_config; |
35 | 35 | ||
36 | if (strcasecmp(argv[1], "solid_color") == 0) { | 36 | if (strcasecmp(argv[1], "solid_color") == 0) { |
37 | output->background = calloc(1, strlen(argv[0]) + 3); | 37 | output->background = strdup(argv[0]); |
38 | snprintf(output->background, strlen(argv[0]) + 3, "\"%s\"", argv[0]); | ||
39 | output->background_option = strdup("solid_color"); | 38 | output->background_option = strdup("solid_color"); |
40 | output->background_fallback = NULL; | 39 | output->background_fallback = NULL; |
41 | argc -= 2; argv += 2; | 40 | argc -= 2; argv += 2; |
@@ -119,16 +118,6 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { | |||
119 | src); | 118 | src); |
120 | free(src); | 119 | free(src); |
121 | } else { | 120 | } else { |
122 | // Escape double quotes in the final path for swaybg | ||
123 | for (size_t i = 0; i < strlen(src); i++) { | ||
124 | if (src[i] == '"') { | ||
125 | src = realloc(src, strlen(src) + 2); | ||
126 | memmove(src + i + 1, src + i, strlen(src + i) + 1); | ||
127 | *(src + i) = '\\'; | ||
128 | i++; | ||
129 | } | ||
130 | } | ||
131 | |||
132 | output->background = src; | 121 | output->background = src; |
133 | output->background_option = strdup(mode); | 122 | output->background_option = strdup(mode); |
134 | } | 123 | } |
@@ -136,9 +125,7 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { | |||
136 | 125 | ||
137 | output->background_fallback = NULL; | 126 | output->background_fallback = NULL; |
138 | if (argc && *argv[0] == '#') { | 127 | if (argc && *argv[0] == '#') { |
139 | output->background_fallback = calloc(1, strlen(argv[0]) + 3); | 128 | output->background_fallback = strdup(argv[0]); |
140 | snprintf(output->background_fallback, strlen(argv[0]) + 3, | ||
141 | "\"%s\"", argv[0]); | ||
142 | argc--; argv++; | 129 | argc--; argv++; |
143 | 130 | ||
144 | if (!can_access) { | 131 | if (!can_access) { |
@@ -153,4 +140,3 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { | |||
153 | config->handler_context.leftovers.argv = argv; | 140 | config->handler_context.leftovers.argv = argv; |
154 | return NULL; | 141 | return NULL; |
155 | } | 142 | } |
156 | |||