mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 07:51:28 +00:00
Changed command handler to perform var subs on all portions of a command
This commit is contained in:
parent
0356ab3eba
commit
fcfcffa1ea
|
@ -41,14 +41,12 @@ bool cmd_bindsym(struct sway_config *config, int argc, char **argv) {
|
|||
binding->command = join_args(argv + 1, argc - 1);
|
||||
|
||||
//Set the first workspace name found to the init_workspace
|
||||
list_t *cargs = split_string(binding->command, " ");
|
||||
if (!config->init_workspace) {
|
||||
if (strcmp("workspace", cargs->items[0]) == 0) {
|
||||
argv[0] = do_var_replacement(config, argv[0]);
|
||||
config->init_workspace = do_var_replacement(config, cargs->items[1]);
|
||||
if (strcmp("workspace", argv[1]) == 0) {
|
||||
config->init_workspace = malloc(strlen(argv[2]) + 1);
|
||||
strcpy(config->init_workspace, argv[2]);
|
||||
}
|
||||
}
|
||||
list_free(cargs);
|
||||
|
||||
list_t *split = split_string(argv[0], "+");
|
||||
int i;
|
||||
|
@ -391,7 +389,10 @@ bool handle_command(struct sway_config *config, char *exec) {
|
|||
char **argv = split_directive(exec + strlen(handler->command), &argc);
|
||||
int i;
|
||||
|
||||
argv[0] = do_var_replacement(config, argv[0]);
|
||||
//Perform var subs on all parts of the command
|
||||
for (i = 0; i < argc; ++i) {
|
||||
argv[i] = do_var_replacement(config, argv[i]);
|
||||
}
|
||||
|
||||
exec_success = handler->handle(config, argc, argv);
|
||||
for (i = 0; i < argc; ++i) {
|
||||
|
|
|
@ -90,7 +90,9 @@ _continue:
|
|||
|
||||
if (!config->init_workspace) {
|
||||
sway_log(L_INFO, "No workspace names set, defaulting to 1");
|
||||
config->init_workspace = "1";
|
||||
char* default_init_workspace = "1";
|
||||
config->init_workspace = malloc(strlen(default_init_workspace) + 1);
|
||||
strcpy(config->init_workspace, default_init_workspace);
|
||||
}
|
||||
|
||||
return config;
|
||||
|
|
Loading…
Reference in a new issue