From 8d63ac594bdea7e1e34f0aa99dc72becbb4f4949 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 11:12:09 -0500 Subject: [PATCH 01/11] Changed workspace name generation to try and use bindsyms when possible --- sway/workspace.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/sway/workspace.c b/sway/workspace.c index 53675c03..96604678 100644 --- a/sway/workspace.c +++ b/sway/workspace.c @@ -12,7 +12,42 @@ swayc_t *active_workspace = NULL; int ws_num = 1; char *workspace_next_name(void) { - int l = 1; + int i; + // Scan all workspace bindings to find the next available workspace name, + // if none are found/available then default to a number + struct sway_mode *mode = config->current_mode; + + for (i = 0; i < mode->bindings->length; ++i) { + const char* command = *binding = mode->bindings->items[i]->command; + list_t *args = split_string(command, " "); + + if (strcmp("workspace", args->items[0]) == 0 && args->length > 2) { + const char* target = args->items[1]; + + while (*target == ' ' || *target == '\t') + target++; + + // Make sure that the command references an actual workspace + // not a command about workspaces + if (strcmp(target, "next") == 0 || + strcmp(target, "prev") == 0 || + strcmp(target, "next_on_output") == 0 || + strcmp(target, "prev_on_output") == 0 || + strcmp(target, "number") == 0 || + strcmp(target, "back_and_forth") == 0 || + strcmp(target, "current") == 0) + continue; + + //Make sure that the workspace doesn't already exist + if (workspace_find_by_name(args->items[2])) + continue; + + return args->items[2]; + } + } + // As a fall back, get the current number of active workspaces + // and return that + 1 for the next workspace's name + int ws_num = root_container.children->length; if (ws_num >= 10) { l = 2; } else if (ws_num >= 100) { From 2c9f5eca89ac5ab1a3eaacc3b56243978098408c Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 11:32:38 -0500 Subject: [PATCH 02/11] Fixes to workspace generation --- sway/main.c | 7 +++---- sway/workspace.c | 18 +++++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sway/main.c b/sway/main.c index 7477b08c..b48d4b19 100644 --- a/sway/main.c +++ b/sway/main.c @@ -18,6 +18,9 @@ int main(int argc, char **argv) { /* Signal handling */ signal(SIGCHLD, sigchld_handle); + if (!load_config()) { + sway_abort("Unable to load config"); + } setenv("WLC_DIM", "0", 0); if (!wlc_init(&interface, argc, argv)) { @@ -25,10 +28,6 @@ int main(int argc, char **argv) { } setenv("DISPLAY", ":1", 1); - if (!load_config()) { - sway_abort("Unable to load config"); - } - wlc_run(); return 0; } diff --git a/sway/workspace.c b/sway/workspace.c index 96604678..9bc6838c 100644 --- a/sway/workspace.c +++ b/sway/workspace.c @@ -6,22 +6,27 @@ #include "list.h" #include "log.h" #include "container.h" +#include "config.h" +#include "stringop.h" swayc_t *active_workspace = NULL; -int ws_num = 1; - char *workspace_next_name(void) { + sway_log(L_DEBUG, "Workspace: Generating new name"); int i; + int l = 1; // Scan all workspace bindings to find the next available workspace name, // if none are found/available then default to a number struct sway_mode *mode = config->current_mode; for (i = 0; i < mode->bindings->length; ++i) { - const char* command = *binding = mode->bindings->items[i]->command; + struct sway_binding *binding = mode->bindings->items[i]; + const char* command = binding->command; list_t *args = split_string(command, " "); + sway_log(L_DEBUG, "Workspace: Checking name '%s'", command); - if (strcmp("workspace", args->items[0]) == 0 && args->length > 2) { + if (strcmp("workspace", args->items[0]) == 0 && args->length > 1) { + sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", args->items[1]); const char* target = args->items[1]; while (*target == ' ' || *target == '\t') @@ -39,11 +44,10 @@ char *workspace_next_name(void) { continue; //Make sure that the workspace doesn't already exist - if (workspace_find_by_name(args->items[2])) + if (workspace_find_by_name(args->items[1])) continue; - return args->items[2]; - } + return args->items[1]; } } // As a fall back, get the current number of active workspaces // and return that + 1 for the next workspace's name From ab130fb56b5c450d3821cfdfc18fc7a37487c70a Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 12:32:43 -0500 Subject: [PATCH 03/11] Added in command queue --- sway/commands.c | 4 +-- sway/config.c | 17 ++++++++++-- sway/config.h | 1 + sway/handlers.c | 13 ++++++++++ sway/workspace.c | 67 +++++++++++++++++++++++++----------------------- 5 files changed, 66 insertions(+), 36 deletions(-) diff --git a/sway/commands.c b/sway/commands.c index 0adda3e7..a370e83a 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -229,8 +229,8 @@ static bool cmd_set(struct sway_config *config, int argc, char **argv) { static bool _do_split(struct sway_config *config, int argc, char **argv, int layout) { char *name = layout == L_VERT ? "splitv": - layout == L_HORIZ ? "splith": - "split"; + layout == L_HORIZ ? "splith": + "split"; if (!checkarg(argc, name, EXPECTED_EQUAL_TO, 0)) { return false; } diff --git a/sway/config.c b/sway/config.c index 6fe681f6..e8ff42dc 100644 --- a/sway/config.c +++ b/sway/config.c @@ -33,6 +33,7 @@ bool load_config() { void config_defaults(struct sway_config *config) { config->symbols = create_list(); config->modes = create_list(); + config->cmd_queue = create_list(); config->current_mode = malloc(sizeof(struct sway_mode)); config->current_mode->name = NULL; config->current_mode->bindings = create_list(); @@ -68,9 +69,20 @@ struct sway_config *read_config(FILE *file, bool is_active) { goto _continue; } - if (!temp_depth && handle_command(config, line) != true) { + // Any command which would require wlc to be initialized + // should be queue for later execution + list_t *args = split_string(line, " "); + sway_log(L_DEBUG, "Checking command %s", line); + if (strcmp("workspace", args->items[0]) == 0) { + sway_log(L_DEBUG, "Deferring command %s", line); + char *cmd = malloc(strlen(line) + 1); + strcpy(cmd, line); + list_add(config->cmd_queue, cmd); + }else if (!temp_depth && !handle_command(config, line)) { + sway_log(L_DEBUG, "Config load failed for line %s", line); success = false; - } + } + list_free(args); _continue: if (line && line[strlen(line) - 1] == '{') { @@ -80,6 +92,7 @@ _continue: } if (success == false) { + sway_log(L_DEBUG, "Config load failed, exiting"); exit(1); } diff --git a/sway/config.h b/sway/config.h index 62b65723..f55453a3 100644 --- a/sway/config.h +++ b/sway/config.h @@ -24,6 +24,7 @@ struct sway_mode { struct sway_config { list_t *symbols; list_t *modes; + list_t *cmd_queue; struct sway_mode *current_mode; // Flags diff --git a/sway/handlers.c b/sway/handlers.c index fe7de75b..220aeb01 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -163,6 +163,16 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w return true; } +static void handle_wlc_ready(void) { + sway_log(L_DEBUG, "Compositor is ready, executing cmds in queue"); + int i; + for (i = 0; i < config->cmd_queue->length; ++i) { + sway_log(L_DEBUG, "Handling command %s", config->cmd_queue->items[i]); + handle_command(config, config->cmd_queue->items[i]); + } + list_free(config->cmd_queue); +} + struct wlc_interface interface = { .output = { @@ -185,6 +195,9 @@ struct wlc_interface interface = { .pointer = { .motion = handle_pointer_motion, .button = handle_pointer_button + }, + .compositor = { + .ready = handle_wlc_ready } }; diff --git a/sway/workspace.c b/sway/workspace.c index 9bc6838c..7b23b7d1 100644 --- a/sway/workspace.c +++ b/sway/workspace.c @@ -14,43 +14,46 @@ swayc_t *active_workspace = NULL; char *workspace_next_name(void) { sway_log(L_DEBUG, "Workspace: Generating new name"); int i; - int l = 1; - // Scan all workspace bindings to find the next available workspace name, - // if none are found/available then default to a number + int l = 1; + // Scan all workspace bindings to find the next available workspace name, + // if none are found/available then default to a number struct sway_mode *mode = config->current_mode; for (i = 0; i < mode->bindings->length; ++i) { struct sway_binding *binding = mode->bindings->items[i]; const char* command = binding->command; - list_t *args = split_string(command, " "); - sway_log(L_DEBUG, "Workspace: Checking name '%s'", command); - - if (strcmp("workspace", args->items[0]) == 0 && args->length > 1) { - sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", args->items[1]); - const char* target = args->items[1]; - - while (*target == ' ' || *target == '\t') - target++; - - // Make sure that the command references an actual workspace - // not a command about workspaces - if (strcmp(target, "next") == 0 || - strcmp(target, "prev") == 0 || - strcmp(target, "next_on_output") == 0 || - strcmp(target, "prev_on_output") == 0 || - strcmp(target, "number") == 0 || - strcmp(target, "back_and_forth") == 0 || - strcmp(target, "current") == 0) - continue; - - //Make sure that the workspace doesn't already exist - if (workspace_find_by_name(args->items[1])) - continue; - - return args->items[1]; } - } - // As a fall back, get the current number of active workspaces - // and return that + 1 for the next workspace's name + list_t *args = split_string(command, " "); + + if (strcmp("workspace", args->items[0]) == 0 && args->length > 1) { + sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", args->items[1]); + const char* target = args->items[1]; + + while (*target == ' ' || *target == '\t') + target++; + + // Make sure that the command references an actual workspace + // not a command about workspaces + if (strcmp(target, "next") == 0 || + strcmp(target, "prev") == 0 || + strcmp(target, "next_on_output") == 0 || + strcmp(target, "prev_on_output") == 0 || + strcmp(target, "number") == 0 || + strcmp(target, "back_and_forth") == 0 || + strcmp(target, "current") == 0) + continue; + + //Make sure that the workspace doesn't already exist + if (workspace_find_by_name(args->items[1])) + continue; + + list_free(args); + + sway_log(L_DEBUG, "Workspace: Found free name %s", args->items[1]); + return args->items[1]; + } + } + // As a fall back, get the current number of active workspaces + // and return that + 1 for the next workspace's name int ws_num = root_container.children->length; if (ws_num >= 10) { l = 2; From 3cdeb9bd5eafee18cb571baa711b8c1ffa9d3161 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 12:44:18 -0500 Subject: [PATCH 04/11] Minor fix to memory management --- sway/workspace.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sway/workspace.c b/sway/workspace.c index 7b23b7d1..906d0c5d 100644 --- a/sway/workspace.c +++ b/sway/workspace.c @@ -26,8 +26,8 @@ char *workspace_next_name(void) { if (strcmp("workspace", args->items[0]) == 0 && args->length > 1) { sway_log(L_DEBUG, "Got valid workspace command for target: '%s'", args->items[1]); - const char* target = args->items[1]; - + char* target = malloc(strlen(args->items[1]) + 1); + strcpy(target, args->items[1]); while (*target == ' ' || *target == '\t') target++; @@ -43,13 +43,14 @@ char *workspace_next_name(void) { continue; //Make sure that the workspace doesn't already exist - if (workspace_find_by_name(args->items[1])) + if (workspace_find_by_name(target)) { continue; + } list_free(args); - sway_log(L_DEBUG, "Workspace: Found free name %s", args->items[1]); - return args->items[1]; + sway_log(L_DEBUG, "Workspace: Found free name %s", target); + return target; } } // As a fall back, get the current number of active workspaces From d12a786160a646dee49503e5423e0e54edf52d52 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 12:53:13 -0500 Subject: [PATCH 05/11] Removed some unnecessary logs --- sway/config.c | 2 -- sway/handlers.c | 1 - 2 files changed, 3 deletions(-) diff --git a/sway/config.c b/sway/config.c index e8ff42dc..2f1ad845 100644 --- a/sway/config.c +++ b/sway/config.c @@ -72,7 +72,6 @@ struct sway_config *read_config(FILE *file, bool is_active) { // Any command which would require wlc to be initialized // should be queue for later execution list_t *args = split_string(line, " "); - sway_log(L_DEBUG, "Checking command %s", line); if (strcmp("workspace", args->items[0]) == 0) { sway_log(L_DEBUG, "Deferring command %s", line); char *cmd = malloc(strlen(line) + 1); @@ -92,7 +91,6 @@ _continue: } if (success == false) { - sway_log(L_DEBUG, "Config load failed, exiting"); exit(1); } diff --git a/sway/handlers.c b/sway/handlers.c index 220aeb01..fd9c61a0 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -167,7 +167,6 @@ static void handle_wlc_ready(void) { sway_log(L_DEBUG, "Compositor is ready, executing cmds in queue"); int i; for (i = 0; i < config->cmd_queue->length; ++i) { - sway_log(L_DEBUG, "Handling command %s", config->cmd_queue->items[i]); handle_command(config, config->cmd_queue->items[i]); } list_free(config->cmd_queue); From 9a0a858d1e29765cb48ec7a6f327fb137a871aa4 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 12:56:08 -0500 Subject: [PATCH 06/11] Typo fix --- sway/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/config.c b/sway/config.c index 2f1ad845..aeadc9a1 100644 --- a/sway/config.c +++ b/sway/config.c @@ -70,7 +70,7 @@ struct sway_config *read_config(FILE *file, bool is_active) { } // Any command which would require wlc to be initialized - // should be queue for later execution + // should be queued for later execution list_t *args = split_string(line, " "); if (strcmp("workspace", args->items[0]) == 0) { sway_log(L_DEBUG, "Deferring command %s", line); From 527288a826bb5602378adccbcd56a4fa8d5dd2bc Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 13:22:20 -0500 Subject: [PATCH 07/11] fixes to cmd queue freeing, style --- sway/commands.c | 3 +-- sway/config.c | 2 +- sway/handlers.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sway/commands.c b/sway/commands.c index a370e83a..000b6c45 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -229,8 +229,7 @@ static bool cmd_set(struct sway_config *config, int argc, char **argv) { static bool _do_split(struct sway_config *config, int argc, char **argv, int layout) { char *name = layout == L_VERT ? "splitv": - layout == L_HORIZ ? "splith": - "split"; + layout == L_HORIZ ? "splith":"split"; if (!checkarg(argc, name, EXPECTED_EQUAL_TO, 0)) { return false; } diff --git a/sway/config.c b/sway/config.c index aeadc9a1..869fa077 100644 --- a/sway/config.c +++ b/sway/config.c @@ -77,7 +77,7 @@ struct sway_config *read_config(FILE *file, bool is_active) { char *cmd = malloc(strlen(line) + 1); strcpy(cmd, line); list_add(config->cmd_queue, cmd); - }else if (!temp_depth && !handle_command(config, line)) { + } else if (!temp_depth && !handle_command(config, line)) { sway_log(L_DEBUG, "Config load failed for line %s", line); success = false; } diff --git a/sway/handlers.c b/sway/handlers.c index fd9c61a0..4411b947 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -169,7 +169,7 @@ static void handle_wlc_ready(void) { for (i = 0; i < config->cmd_queue->length; ++i) { handle_command(config, config->cmd_queue->items[i]); } - list_free(config->cmd_queue); + free_flat_list(config->cmd_queue); } From 7788aa4cbd0bf260134e9680d8a00de076290f43 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 13:26:00 -0500 Subject: [PATCH 08/11] More style fixes --- sway/commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/commands.c b/sway/commands.c index 000b6c45..09a19025 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -229,7 +229,7 @@ static bool cmd_set(struct sway_config *config, int argc, char **argv) { static bool _do_split(struct sway_config *config, int argc, char **argv, int layout) { char *name = layout == L_VERT ? "splitv": - layout == L_HORIZ ? "splith":"split"; + layout == L_HORIZ ? "splith":"split"; if (!checkarg(argc, name, EXPECTED_EQUAL_TO, 0)) { return false; } From d785cbd54c8813ad0e19c82ee6179ca335af588b Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 13:28:01 -0500 Subject: [PATCH 09/11] Even more style fixes --- sway/commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/commands.c b/sway/commands.c index 09a19025..cae35237 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -229,7 +229,7 @@ static bool cmd_set(struct sway_config *config, int argc, char **argv) { static bool _do_split(struct sway_config *config, int argc, char **argv, int layout) { char *name = layout == L_VERT ? "splitv": - layout == L_HORIZ ? "splith":"split"; + layout == L_HORIZ ? "splith":"split"; if (!checkarg(argc, name, EXPECTED_EQUAL_TO, 0)) { return false; } From ea9efc884d92d32863287b8d8e5a5f8bd631f9f5 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 14:41:29 -0500 Subject: [PATCH 10/11] Allowed for execd commands to be spawned after abort --- sway/commands.c | 2 +- sway/config.c | 44 ++++++++++++++++++++++++++++---------------- sway/config.h | 5 +++-- sway/handlers.c | 9 +++++++++ sway/main.c | 3 ++- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/sway/commands.c b/sway/commands.c index cae35237..c95b9858 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -229,7 +229,7 @@ static bool cmd_set(struct sway_config *config, int argc, char **argv) { static bool _do_split(struct sway_config *config, int argc, char **argv, int layout) { char *name = layout == L_VERT ? "splitv": - layout == L_HORIZ ? "splith":"split"; + layout == L_HORIZ ? "splith":"split"; if (!checkarg(argc, name, EXPECTED_EQUAL_TO, 0)) { return false; } diff --git a/sway/config.c b/sway/config.c index 869fa077..d96d23fc 100644 --- a/sway/config.c +++ b/sway/config.c @@ -25,9 +25,16 @@ bool load_config() { return false; } free(temp); - config = read_config(f, false); + + bool config_load_success; + if (config) { + config_load_success = read_config(f, true); + } else { + config_load_success = read_config(f, false); + } fclose(f); - return true; + + return config_load_success; } void config_defaults(struct sway_config *config) { @@ -42,14 +49,17 @@ void config_defaults(struct sway_config *config) { config->focus_follows_mouse = true; config->mouse_warping = true; config->reloading = false; + config->active = false; + config->failed = false; } -struct sway_config *read_config(FILE *file, bool is_active) { - struct sway_config *config = malloc(sizeof(struct sway_config)); - config_defaults(config); - +bool read_config(FILE *file, bool is_active) { + struct sway_config *temp_config = malloc(sizeof(struct sway_config)); + config_defaults(temp_config); if (is_active) { - config->reloading = true; + sway_log(L_DEBUG, "Performing configuration file reload"); + temp_config->reloading = true; + temp_config->active = true; } bool success = true; @@ -72,14 +82,19 @@ struct sway_config *read_config(FILE *file, bool is_active) { // Any command which would require wlc to be initialized // should be queued for later execution list_t *args = split_string(line, " "); - if (strcmp("workspace", args->items[0]) == 0) { + if (!is_active && ( + strcmp("workspace", args->items[0]) == 0 || + strcmp("exec", args->items[0]) == 0 || + strcmp("exec_always", args->items[0]) == 0 )) { sway_log(L_DEBUG, "Deferring command %s", line); + char *cmd = malloc(strlen(line) + 1); strcpy(cmd, line); - list_add(config->cmd_queue, cmd); - } else if (!temp_depth && !handle_command(config, line)) { + list_add(temp_config->cmd_queue, cmd); + } else if (!temp_depth && !handle_command(temp_config, line)) { sway_log(L_DEBUG, "Config load failed for line %s", line); success = false; + temp_config->failed = true; } list_free(args); @@ -90,15 +105,12 @@ _continue: free(line); } - if (success == false) { - exit(1); - } - if (is_active) { - config->reloading = false; + temp_config->reloading = false; } + config = temp_config; - return config; + return success; } char *do_var_replacement(struct sway_config *config, char *str) { diff --git a/sway/config.h b/sway/config.h index f55453a3..c9fd374c 100644 --- a/sway/config.h +++ b/sway/config.h @@ -30,12 +30,13 @@ struct sway_config { // Flags bool focus_follows_mouse; bool mouse_warping; - + bool active; + bool failed; bool reloading; }; bool load_config(); -struct sway_config *read_config(FILE *file, bool is_active); +bool read_config(FILE *file, bool is_active); char *do_var_replacement(struct sway_config *config, char *str); extern struct sway_config *config; diff --git a/sway/handlers.c b/sway/handlers.c index 4411b947..48c6cbf7 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -8,6 +8,7 @@ #include "config.h" #include "commands.h" #include "handlers.h" +#include "stringop.h" static bool handle_output_created(wlc_handle output) { add_output(output); @@ -165,11 +166,19 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w static void handle_wlc_ready(void) { sway_log(L_DEBUG, "Compositor is ready, executing cmds in queue"); + int i; for (i = 0; i < config->cmd_queue->length; ++i) { handle_command(config, config->cmd_queue->items[i]); } free_flat_list(config->cmd_queue); + + if (config->failed) { + sway_log(L_ERROR, "Programs have been execd, aborting!"); + sway_abort("Unable to load config"); + } + + config->active = true; } diff --git a/sway/main.c b/sway/main.c index b48d4b19..061564e2 100644 --- a/sway/main.c +++ b/sway/main.c @@ -19,7 +19,7 @@ int main(int argc, char **argv) { signal(SIGCHLD, sigchld_handle); if (!load_config()) { - sway_abort("Unable to load config"); + sway_log(L_ERROR, "Config load failed, aborting sway post init!"); } setenv("WLC_DIM", "0", 0); @@ -29,6 +29,7 @@ int main(int argc, char **argv) { setenv("DISPLAY", ":1", 1); wlc_run(); + return 0; } From ffe59b27a956e4430a97d65874ef15c5e9129ee0 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Thu, 13 Aug 2015 14:49:34 -0500 Subject: [PATCH 11/11] Style fix --- sway/commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/commands.c b/sway/commands.c index c95b9858..cae35237 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -229,7 +229,7 @@ static bool cmd_set(struct sway_config *config, int argc, char **argv) { static bool _do_split(struct sway_config *config, int argc, char **argv, int layout) { char *name = layout == L_VERT ? "splitv": - layout == L_HORIZ ? "splith":"split"; + layout == L_HORIZ ? "splith":"split"; if (!checkarg(argc, name, EXPECTED_EQUAL_TO, 0)) { return false; }