diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 9d925457..9b82d81b 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -1226,6 +1226,10 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, func = toggle_all_floating; } else if (strcmp(func_name, "dwindle_toggle_split_direction") == 0) { func = dwindle_toggle_split_direction; + } else if (strcmp(func_name, "dwindle_split_horizontal") == 0) { + func = dwindle_split_horizontal; + } else if (strcmp(func_name, "dwindle_split_vertical") == 0) { + func = dwindle_split_vertical; } else { return NULL; } diff --git a/src/dispatch/bind_declare.h b/src/dispatch/bind_declare.h index 41945dda..b79ad689 100644 --- a/src/dispatch/bind_declare.h +++ b/src/dispatch/bind_declare.h @@ -71,4 +71,6 @@ int32_t enable_monitor(const Arg *arg); int32_t toggle_monitor(const Arg *arg); int32_t scroller_stack(const Arg *arg); int32_t toggle_all_floating(const Arg *arg); -int32_t dwindle_toggle_split_direction(const Arg *arg); \ No newline at end of file +int32_t dwindle_toggle_split_direction(const Arg *arg); +int32_t dwindle_split_horizontal(const Arg *arg); +int32_t dwindle_split_vertical(const Arg *arg); \ No newline at end of file diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index ff5ccdf5..2161f39b 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -1923,13 +1923,7 @@ int32_t toggle_all_floating(const Arg *arg) { return 0; } -int32_t dwindle_toggle_split_direction(const Arg *arg) { - if (!selmon || !selmon->sel) - return 0; - - Client *c = selmon->sel; - if (!c || !c->mon || c->isfloating) - return 0; +int32_t dwindle_set_split_direction(Client *c, bool istoggle, bool horizontal) { const Layout *layout = c->mon->pertag->ltidxs[c->mon->pertag->curtag]; @@ -1942,8 +1936,44 @@ int32_t dwindle_toggle_split_direction(const Arg *arg) { if (!leaf) return 0; - leaf->custom_leaf_split_h = !leaf->custom_leaf_split_h; + if (istoggle) { + leaf->custom_leaf_split_h = !leaf->custom_leaf_split_h; + } else if (horizontal) { + leaf->custom_leaf_split_h = true; + } else { + leaf->custom_leaf_split_h = false; + } bool hit_no_border = check_hit_no_border(c); apply_split_border(c, hit_no_border); return 0; +} + +int32_t dwindle_toggle_split_direction(const Arg *arg) { + if (!selmon || !selmon->sel) + return 0; + + Client *c = selmon->sel; + if (!c || !c->mon || c->isfloating) + return 0; + return dwindle_set_split_direction(selmon->sel, true, false); +} + +int32_t dwindle_split_horizontal(const Arg *arg) { + if (!selmon || !selmon->sel) + return 0; + + Client *c = selmon->sel; + if (!c || !c->mon || c->isfloating) + return 0; + return dwindle_set_split_direction(selmon->sel, false, true); +} + +int32_t dwindle_split_vertical(const Arg *arg) { + if (!selmon || !selmon->sel) + return 0; + + Client *c = selmon->sel; + if (!c || !c->mon || c->isfloating) + return 0; + return dwindle_set_split_direction(selmon->sel, false, false); } \ No newline at end of file