feat(wm): promote

The first tile of a layout is its largest, and the place for the window being
worked on. `komorebic promote` moves the focused window there, with the windows
that were before it each moving one tile on; `promote-swap` swaps it with the
window that has the first tile, and from the first tile swaps it back with the
window it was last swapped with; `promote-window left|right|up|down` promotes
the window on that side of the focused one; and `promote-focus` gives the focus
to the first tile and moves nothing.

The grid layout has no largest tile, so the four do nothing there.

The vm-commands sweep gains the four.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:37 -07:00
1 parent 95eb4d5039
commit 554d77aed9
17 files changed
+419 -6

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
```text
Promote the user focus to the largest window container
Usage: promote-focus
Options:
-h, --help
Print help
```
+10
View File
@@ -0,0 +1,10 @@
```text
Promote the focused window to the largest tile by swapping container indices with the largest tile
Usage: promote-swap
Options:
-h, --help
Print help
```
+14
View File
@@ -0,0 +1,14 @@
```text
Promote the window in the specified direction
Usage: promote-window <OPERATION_DIRECTION>
Arguments:
<OPERATION_DIRECTION>
[possible values: left, right, up, down]
Options:
-h, --help
Print help
```
+10
View File
@@ -0,0 +1,10 @@
```text
Promote the focused window to the largest tile via container removal and re-insertion
Usage: promote
Options:
-h, --help
Print help
```
+17 -3
View File
@@ -285,6 +285,15 @@ focused container has changed, which scrolls the strip to it. KWin keeps part of
resizes on an output, so the bridge asks again for the position of a window KWin pulled back
within a second of the command, three times at most ([`bridge.js`]'s `settle`).
`Promote` moves the focused container to index 0, the largest tile of every layout but the grid,
through `LockableSequence`, so the containers before it move one index on
([`WindowManager::promote_container_to_front`]). `PromoteSwap` swaps it with the container at
index 0 and records the index it came from in [`Workspace::promotion_swap_container_idx`], so
that from index 0 it swaps back ([`WindowManager::promote_container_swap`]). `PromoteFocus`
focuses the container at index 0 ([`WindowManager::promote_focus_to_front`]), and
`PromoteWindow` focuses the container in a direction and promotes it. On the grid layout they
change nothing.
`ResizeWindowEdge` and `ResizeWindowAxis` resize the focused container
([`WindowManager::resize_window`]). A resize is an adjustment of the container's tile, kept in
[`Workspace::resize_dimensions`], one per container, which the layout applies when it calculates
@@ -352,8 +361,8 @@ module's unit.
changes its containers.
- [`window_manager`](../../komorebi/src/window_manager.rs): the [`WindowManager`] and the
operations on it (tile the workspace in front, tile every monitor, take a minimized
window out, move the focus, move the focused container, change the layout, resize the
focused container).
window out, move the focus, move the focused container, change the layout, resize or
promote the focused container).
- [`desktop`](../../komorebi/src/desktop.rs): loads the monitors and the open windows from
the backend.
- [`window_manager_event`](../../komorebi/src/window_manager_event.rs) and
@@ -553,7 +562,8 @@ A window is shown, and ends up on a tile:
commands against the fake;
[`komorebi/tests/layout_options.rs`](../../komorebi/tests/layout_options.rs) and
[`komorebi/tests/scrolling.rs`](../../komorebi/tests/scrolling.rs), the layout options and the
scrolling layout; [`komorebi/tests/resize.rs`](../../komorebi/tests/resize.rs), resizing.
scrolling layout; [`komorebi/tests/resize.rs`](../../komorebi/tests/resize.rs), resizing;
[`komorebi/tests/promote.rs`](../../komorebi/tests/promote.rs), promoting.
- [`nix/tests/vm/suites/scrolling`](../../nix/tests/vm/suites/scrolling/test.py): the scrolling
strip in a real KWin, with its columns out of view off the screen.
- [`nix/tests/vm/suites/commands`](../../nix/tests/vm/suites/commands/test.py): every layout,
@@ -593,6 +603,10 @@ A window is shown, and ends up on a tile:
[`Workspace::layout_options`]: ../../komorebi/src/workspace.rs
[`Workspace::resize_dimensions`]: ../../komorebi/src/workspace.rs
[`WindowManager::resize_window`]: ../../komorebi/src/window_manager.rs
[`WindowManager::promote_container_to_front`]: ../../komorebi/src/window_manager.rs
[`WindowManager::promote_container_swap`]: ../../komorebi/src/window_manager.rs
[`WindowManager::promote_focus_to_front`]: ../../komorebi/src/window_manager.rs
[`Workspace::promotion_swap_container_idx`]: ../../komorebi/src/workspace.rs
[`WindowManager::resize_delta`]: ../../komorebi/src/window_manager.rs
[`Workspace::latest_layout`]: ../../komorebi/src/workspace.rs
[`LayoutOptions`]: ../../komorebi/src/core/mod.rs
+5
View File
@@ -33,6 +33,11 @@ komorebic cycle-focus next
komorebic cycle-focus previous
```
## The largest tile
[`komorebic promote-focus`](../cli/promote-focus.md) focuses the window on the first tile of the
layout, which is its largest ([Moving windows](moving-windows.md#to-the-largest-tile)).
## The pointer
By default the pointer moves to the middle of the window that is given the focus. komorebi asks
+23
View File
@@ -32,6 +32,29 @@ komorebic cycle-move next
komorebic cycle-move previous
```
## To the largest tile
The first tile of a layout is the largest one: the left half in BSP and the vertical stack, the
top half in the horizontal stack, the middle of the ultrawide vertical stack and the right half
in the right main vertical stack. In the columns, rows and scrolling layouts it is the first
column or row. The grid layout is left alone: these commands do nothing there.
[`komorebic promote`](../cli/promote.md) moves the focused window to the first tile, and the
windows that were before it each move one tile on.
[`komorebic promote-swap`](../cli/promote-swap.md) swaps the focused window with the window on
the first tile instead, and from the first tile swaps it back with the window it was last
swapped with. [`komorebic promote-window`](../cli/promote-window.md) promotes the window on one
side of the focused one.
```sh
komorebic promote
komorebic promote-swap
komorebic promote-window left
```
[`komorebic promote-focus`](../cli/promote-focus.md) gives the focus to the window on the first
tile and moves nothing.
## The pointer
The pointer follows the window that moved, unless