mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 16:01:27 +00:00
Changed command handler to perform var subs on all cmd args
Fixed workspace_next_name to use the first workspace name it can find in the config
Minor fixes
Changed command handler to perform var subs on all portions of a command
Revert "Changed command handler to perform var subs on all portions of a command"
This reverts commit fcfcffa1ea
.
Var sub fixes
Minor fixes
More minor fixes
This commit is contained in:
parent
803a4739b6
commit
a5b02791d4
|
@ -34,7 +34,6 @@ bool cmd_bindsym(struct sway_config *config, int argc, char **argv) {
|
||||||
sway_log(L_ERROR, "Invalid set command (expected 2 arguments, got %d)", argc);
|
sway_log(L_ERROR, "Invalid set command (expected 2 arguments, got %d)", argc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
argv[0] = do_var_replacement(config, argv[0]);
|
|
||||||
|
|
||||||
struct sway_binding *binding = malloc(sizeof(struct sway_binding));
|
struct sway_binding *binding = malloc(sizeof(struct sway_binding));
|
||||||
binding->keys = create_list();
|
binding->keys = create_list();
|
||||||
|
@ -381,6 +380,12 @@ bool handle_command(struct sway_config *config, char *exec) {
|
||||||
int argc;
|
int argc;
|
||||||
char **argv = split_directive(exec + strlen(handler->command), &argc);
|
char **argv = split_directive(exec + strlen(handler->command), &argc);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
//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);
|
exec_success = handler->handle(config, argc, argv);
|
||||||
for (i = 0; i < argc; ++i) {
|
for (i = 0; i < argc; ++i) {
|
||||||
free(argv[i]);
|
free(argv[i]);
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
struct sway_config *config;
|
||||||
|
|
||||||
bool load_config() {
|
bool load_config() {
|
||||||
sway_log(L_INFO, "Loading config");
|
sway_log(L_INFO, "Loading config");
|
||||||
// TODO: Allow use of more config file locations
|
// TODO: Allow use of more config file locations
|
||||||
|
@ -82,7 +84,7 @@ _continue:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_active) {
|
if (is_active) {
|
||||||
config->reloading = true;
|
config->reloading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "handlers.h"
|
#include "handlers.h"
|
||||||
|
|
||||||
struct sway_config *config;
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
init_log(L_DEBUG); // TODO: Control this with command line arg
|
init_log(L_DEBUG); // TODO: Control this with command line arg
|
||||||
|
@ -42,8 +41,8 @@ int main(int argc, char **argv) {
|
||||||
if (!wlc_init(&interface, argc, argv)) {
|
if (!wlc_init(&interface, argc, argv)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
setenv("DISPLAY", ":1", 1);
|
setenv("DISPLAY", ":1", 1);
|
||||||
|
|
||||||
if (!load_config()) {
|
if (!load_config()) {
|
||||||
sway_abort("Unable to load config");
|
sway_abort("Unable to load config");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue