|
|
@ -78,6 +78,28 @@ int cmd_exec(struct sway_config *config, int argc, char **argv) {
|
|
|
|
sway_log(L_ERROR, "Invalid exec command (expected at least 1 argument, got %d)", argc);
|
|
|
|
sway_log(L_ERROR, "Invalid exec command (expected at least 1 argument, got %d)", argc);
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (config->reloading) {
|
|
|
|
|
|
|
|
sway_log(L_DEBUG, "Ignoring exec %s due to reload", join_args(argv, argc));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fork() == 0) {
|
|
|
|
|
|
|
|
char *args = join_args(argv, argc);
|
|
|
|
|
|
|
|
sway_log(L_DEBUG, "Executing %s", args);
|
|
|
|
|
|
|
|
execl("/bin/sh", "sh", "-c", args, (char *)NULL);
|
|
|
|
|
|
|
|
free(args);
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cmd_exec_always(struct sway_config *config, int argc, char **argv) {
|
|
|
|
|
|
|
|
if (argc < 1) {
|
|
|
|
|
|
|
|
sway_log(L_ERROR, "Invalid exec_always command (expected at least 1 argument, got %d)", argc);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (fork() == 0) {
|
|
|
|
if (fork() == 0) {
|
|
|
|
char *args = join_args(argv, argc);
|
|
|
|
char *args = join_args(argv, argc);
|
|
|
|
sway_log(L_DEBUG, "Executing %s", args);
|
|
|
|
sway_log(L_DEBUG, "Executing %s", args);
|
|
|
@ -152,6 +174,18 @@ int cmd_layout(struct sway_config *config, int argc, char **argv) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cmd_reload(struct sway_config *config, int argc, char **argv) {
|
|
|
|
|
|
|
|
if (argc != 0) {
|
|
|
|
|
|
|
|
sway_log(L_ERROR, "Invalid reload command (expected 0 arguments, got %d)", argc);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!load_config()) {
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int cmd_set(struct sway_config *config, int argc, char **argv) {
|
|
|
|
int cmd_set(struct sway_config *config, int argc, char **argv) {
|
|
|
|
if (argc != 2) {
|
|
|
|
if (argc != 2) {
|
|
|
|
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);
|
|
|
@ -232,12 +266,14 @@ int cmd_fullscreen(struct sway_config *config, int argc, char **argv) {
|
|
|
|
struct cmd_handler handlers[] = {
|
|
|
|
struct cmd_handler handlers[] = {
|
|
|
|
{ "bindsym", cmd_bindsym },
|
|
|
|
{ "bindsym", cmd_bindsym },
|
|
|
|
{ "exec", cmd_exec },
|
|
|
|
{ "exec", cmd_exec },
|
|
|
|
|
|
|
|
{ "exec_always", cmd_exec_always },
|
|
|
|
{ "exit", cmd_exit },
|
|
|
|
{ "exit", cmd_exit },
|
|
|
|
{ "focus", cmd_focus },
|
|
|
|
{ "focus", cmd_focus },
|
|
|
|
{ "focus_follows_mouse", cmd_focus_follows_mouse },
|
|
|
|
{ "focus_follows_mouse", cmd_focus_follows_mouse },
|
|
|
|
{ "fullscreen", cmd_fullscreen },
|
|
|
|
{ "fullscreen", cmd_fullscreen },
|
|
|
|
{ "layout", cmd_layout },
|
|
|
|
{ "layout", cmd_layout },
|
|
|
|
{ "log_colors", cmd_log_colors },
|
|
|
|
{ "log_colors", cmd_log_colors },
|
|
|
|
|
|
|
|
{ "reload", cmd_reload },
|
|
|
|
{ "set", cmd_set },
|
|
|
|
{ "set", cmd_set },
|
|
|
|
{ "splith", cmd_splith },
|
|
|
|
{ "splith", cmd_splith },
|
|
|
|
{ "splitv", cmd_splitv }
|
|
|
|
{ "splitv", cmd_splitv }
|
|
|
|