diff options
author | Zandr Martin <zandrmartin@users.noreply.github.com> | 2016-06-11 09:33:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-11 09:33:24 -0500 |
commit | 66caee645cc276bf747ae492df02c08d978ee90d (patch) | |
tree | 034b3d95fd283d934462df8740430cc53786f105 /sway/commands.c | |
parent | clean up pid/workspace stuff (diff) | |
parent | Many improvements to man pages (diff) | |
download | sway-66caee645cc276bf747ae492df02c08d978ee90d.tar.gz sway-66caee645cc276bf747ae492df02c08d978ee90d.tar.zst sway-66caee645cc276bf747ae492df02c08d978ee90d.zip |
Merge branch 'master' into assign-command
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c index 08920c1c..3a6b2af5 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -1639,7 +1639,7 @@ static struct cmd_results *cmd_output(int argc, char **argv) { | |||
1639 | } | 1639 | } |
1640 | char *src = join_args(argv + i, argc - i - 1); | 1640 | char *src = join_args(argv + i, argc - i - 1); |
1641 | char *mode = argv[argc - 1]; | 1641 | char *mode = argv[argc - 1]; |
1642 | if (wordexp(src, &p, 0) != 0) { | 1642 | if (wordexp(src, &p, 0) != 0 || p.we_wordv[0] == NULL) { |
1643 | return cmd_results_new(CMD_INVALID, "output", "Invalid syntax (%s)", src); | 1643 | return cmd_results_new(CMD_INVALID, "output", "Invalid syntax (%s)", src); |
1644 | } | 1644 | } |
1645 | free(src); | 1645 | free(src); |
@@ -1699,9 +1699,13 @@ static struct cmd_results *cmd_output(int argc, char **argv) { | |||
1699 | swayc_t *cont = NULL; | 1699 | swayc_t *cont = NULL; |
1700 | for (int i = 0; i < root_container.children->length; ++i) { | 1700 | for (int i = 0; i < root_container.children->length; ++i) { |
1701 | cont = root_container.children->items[i]; | 1701 | cont = root_container.children->items[i]; |
1702 | if (cont->name && strcmp(cont->name, output->name) == 0) { | 1702 | if (cont->name && ((strcmp(cont->name, output->name) == 0) || (strcmp(output->name, "*") == 0))) { |
1703 | apply_output_config(output, cont); | 1703 | apply_output_config(output, cont); |
1704 | break; | 1704 | |
1705 | if (strcmp(output->name, "*") != 0) { | ||
1706 | // stop looking if the output config isn't applicable to all outputs | ||
1707 | break; | ||
1708 | } | ||
1705 | } | 1709 | } |
1706 | } | 1710 | } |
1707 | } | 1711 | } |
@@ -2153,12 +2157,26 @@ static int compare_set_qsort(const void *_l, const void *_r) { | |||
2153 | } | 2157 | } |
2154 | 2158 | ||
2155 | static struct cmd_results *cmd_set(int argc, char **argv) { | 2159 | static struct cmd_results *cmd_set(int argc, char **argv) { |
2160 | char *tmp; | ||
2161 | int size; | ||
2156 | struct cmd_results *error = NULL; | 2162 | struct cmd_results *error = NULL; |
2157 | if (!config->reading) return cmd_results_new(CMD_FAILURE, "set", "Can only be used in config file."); | 2163 | if (!config->reading) return cmd_results_new(CMD_FAILURE, "set", "Can only be used in config file."); |
2158 | if ((error = checkarg(argc, "set", EXPECTED_AT_LEAST, 2))) { | 2164 | if ((error = checkarg(argc, "set", EXPECTED_AT_LEAST, 2))) { |
2159 | return error; | 2165 | return error; |
2160 | } | 2166 | } |
2161 | 2167 | ||
2168 | if (argv[0][0] != '$') { | ||
2169 | sway_log(L_INFO, "Warning: variable '%s' doesn't start with $", argv[0]); | ||
2170 | |||
2171 | size = asprintf(&tmp, "%s%s", "$", argv[0]); | ||
2172 | if (size == -1) { | ||
2173 | return cmd_results_new(CMD_FAILURE, "set", "Not possible to create variable $'%s'", argv[0]); | ||
2174 | } | ||
2175 | |||
2176 | argv[0] = strdup(tmp); | ||
2177 | free(tmp); | ||
2178 | } | ||
2179 | |||
2162 | struct sway_variable *var = NULL; | 2180 | struct sway_variable *var = NULL; |
2163 | // Find old variable if it exists | 2181 | // Find old variable if it exists |
2164 | int i; | 2182 | int i; |
@@ -3040,7 +3058,7 @@ static struct cmd_results *bar_cmd_swaybar_command(int argc, char **argv) { | |||
3040 | } | 3058 | } |
3041 | 3059 | ||
3042 | static struct cmd_results *bar_cmd_tray_output(int argc, char **argv) { | 3060 | static struct cmd_results *bar_cmd_tray_output(int argc, char **argv) { |
3043 | sway_log(L_ERROR, "warning: tray_output is not supported on wayland"); | 3061 | sway_log(L_ERROR, "Warning: tray_output is not supported on wayland"); |
3044 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 3062 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
3045 | } | 3063 | } |
3046 | 3064 | ||