feat: add dispatch toggle_all_floating

This commit is contained in:
DreamMaoMao 2026-03-19 07:56:29 +08:00
parent 6f860e8364
commit 21b30f179d
5 changed files with 22 additions and 1 deletions

View file

@ -1180,6 +1180,8 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
} else if (strcmp(func_name, "scroller_stack") == 0) {
func = scroller_stack;
(*arg).i = parse_direction(arg_value);
} else if (strcmp(func_name, "toggle_all_floating") == 0) {
func = toggle_all_floating;
} else {
return NULL;
}

View file

@ -70,3 +70,4 @@ int32_t disable_monitor(const Arg *arg);
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);

View file

@ -1867,3 +1867,19 @@ int32_t scroller_stack(const Arg *arg) {
arrange(selmon, false, false);
return 0;
}
int32_t toggle_all_floating(const Arg *arg) {
if (!selmon || !selmon->sel)
return 0;
Client *c = NULL;
bool should_floating = !selmon->sel->isfloating;
wl_list_for_each(c, &clients, link) {
if (VISIBLEON(c, selmon)) {
if (c->isfloating != should_floating) {
setfloating(c, should_floating);
}
}
}
return 0;
}

View file

@ -5095,7 +5095,8 @@ setfloating(Client *c, int32_t floating) {
layers[c->isfloating ? LyrTop : LyrTile]);
}
if (!c->isfloating && old_floating_state && (c->old_stack_inner_per > 0.0f || c->old_master_inner_per > 0.0f)) {
if (!c->isfloating && old_floating_state &&
(c->old_stack_inner_per > 0.0f || c->old_master_inner_per > 0.0f)) {
restore_size_per(c->mon, c);
}