layout toggle: take any combination of layouts as arguments (#2649)
With this PR the 'layout toggle' command can be passed any combination of valid layout keywords as arguments. They will be activated one after another each time you issue the command, advancing from left to right always selecting the layout after the currently active layout or the leftmost layout if the active layout is not in the argument list. This PR also incorporates the feature request from #2476.
This commit is contained in:
11
src/util.c
11
src/util.c
@ -66,7 +66,7 @@ __attribute__((pure)) bool name_is_digits(const char *name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Set 'out' to the layout_t value for the given layout. The function
|
||||
* returns true on success or false if the passed string is not a valid
|
||||
* layout name.
|
||||
@ -75,20 +75,23 @@ __attribute__((pure)) bool name_is_digits(const char *name) {
|
||||
bool layout_from_name(const char *layout_str, layout_t *out) {
|
||||
if (strcmp(layout_str, "default") == 0) {
|
||||
*out = L_DEFAULT;
|
||||
return true;
|
||||
} else if (strcasecmp(layout_str, "stacked") == 0 ||
|
||||
strcasecmp(layout_str, "stacking") == 0) {
|
||||
*out = L_STACKED;
|
||||
return true;
|
||||
} else if (strcasecmp(layout_str, "tabbed") == 0) {
|
||||
*out = L_TABBED;
|
||||
return true;
|
||||
} else if (strcasecmp(layout_str, "splitv") == 0) {
|
||||
*out = L_SPLITV;
|
||||
return true;
|
||||
} else if (strcasecmp(layout_str, "splith") == 0) {
|
||||
*out = L_SPLITH;
|
||||
} else {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user