diff --git a/docs/bindings/keys.md b/docs/bindings/keys.md index 64ba64b7..4c318fb3 100644 --- a/docs/bindings/keys.md +++ b/docs/bindings/keys.md @@ -90,6 +90,7 @@ bindr=Super,Super_L,spawn,rofi -show run | :--- | :--- | :--- | | `killclient` | - | Close the focused window. | | `togglefloating` | - | Toggle floating state. | +| `toggle_all_floating` | - | Toggle all visible clients floating state. | | `togglefullscreen` | - | Toggle fullscreen. | | `togglefakefullscreen` | - | Toggle "fake" fullscreen (remains constrained). | | `togglemaximizescreen` | - | Maximize window (keep decoration/bar). | diff --git a/src/config/parse_config.h b/src/config/parse_config.h index f103c4f0..fda401d9 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -1202,6 +1202,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; } diff --git a/src/dispatch/bind_declare.h b/src/dispatch/bind_declare.h index 7dced532..dbeebd33 100644 --- a/src/dispatch/bind_declare.h +++ b/src/dispatch/bind_declare.h @@ -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); \ No newline at end of file diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 449adf3b..d6854a0c 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -1866,3 +1866,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; +} diff --git a/src/mango.c b/src/mango.c index dae16898..9dac7bb4 100644 --- a/src/mango.c +++ b/src/mango.c @@ -5098,7 +5098,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); }