scrolling: add promote layoutmsg

This commit is contained in:
Vaxry 2025-05-24 14:31:35 +02:00
parent 19dc215230
commit c04dee3d0c
Signed by: vaxry
GPG key ID: 665806380871D640
2 changed files with 14 additions and 1 deletions

View file

@ -23,4 +23,5 @@ Adds a scrolling layout to Hyprland.
| colresize | resize the current column, to either a value or by a relative value e.g. `0.5`, `+0.2`, `-0.2` or cycle the preconfigured ones with `+conf` or `-conf`. Can also be `all (number)` for resizing all columns to a specific width | relative float / relative conf |
| movewindowto | same as the movewindow dispatcher but supports promotion to the right at the end | direction |
| fit | executes a fit operation based on the argument. Available: `active`, `visible`, `all`, `toend`, `tobeg` | fit mode |
| focus | moves the focus and centers the layout, while also wrapping instead of moving to neighbring monitors. | direction |
| focus | moves the focus and centers the layout, while also wrapping instead of moving to neighbring monitors. | direction |
| promote | moves a window to its own new column | none |

View file

@ -990,6 +990,18 @@ std::any CScrollingLayout::layoutMessage(SLayoutMessageHeader header, std::strin
default: return {};
}
} else if (ARGS[0] == "promote") {
const auto WDATA = dataFor(g_pCompositor->m_lastWindow.lock());
if (!WDATA)
return {};
auto idx = WDATA->column->workspace->idx(WDATA->column.lock());
auto col = idx == -1 ? WDATA->column->workspace->add() : WDATA->column->workspace->add(idx);
WDATA->column->remove(WDATA->window.lock());
col->add(WDATA);
}
return {};