Skip to content

Commit dc515f7

Browse files
committed
cmds:output: fix quoted defs not stripped
With the following config: def $abc "wayland wayland " The following command would fail to be executed: swaymsg -- output '$abc' scale 2 The definition `$abc` is replaced with its content, including the quotes, which fails to match real output names. We now strip quotes early in the output command.
1 parent 40bdd0e commit dc515f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sway/commands/output.c

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "sway/commands.h"
33
#include "sway/config.h"
44
#include "sway/output.h"
5+
#include "stringop.h"
56
#include "list.h"
67
#include "log.h"
78

@@ -39,6 +40,13 @@ struct cmd_results *cmd_output(int argc, char **argv) {
3940
"Refusing to configure the no op output");
4041
}
4142

43+
// Handle cases where output name was replaced by a definition with quotes
44+
for (int i = 0; i < argc; ++i) {
45+
if (*argv[i] == '\"' || *argv[i] == '\'') {
46+
strip_quotes(argv[i]);
47+
}
48+
}
49+
4250
struct output_config *output = NULL;
4351
if (strcmp(argv[0], "-") == 0 || strcmp(argv[0], "--") == 0) {
4452
if (config->reading) {

0 commit comments

Comments
 (0)