mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-23 21:37:53 -04:00
feat: add dwindle_split_horizontal and dwindle_split_vertical
This commit is contained in:
parent
65c9ac6dd2
commit
c822f5d5b9
3 changed files with 45 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
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);
|
||||
|
|
@ -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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue