feat(wm): float

Some windows are better left out of the layout. `komorebic toggle-float` takes
the window that has the focus out of its container into the floating windows of
the workspace, which komorebi gives no tile and does not move, and the other
windows share the work area; on a floating window it puts it back in a container
at the focused place.

A floating window is in the index of managed windows like any other, so its
events find it, and it is in the state as the workspace's `floating_windows`.
Where a floated window goes is the `toggle_float_placement` of the window
management behaviour: by default it stays where it is, since the spike's
centering of floated windows waited for a configuration file. Centering and
resizing to the floating aspect ratio come with it.

Opening windows floating (the float override and the float rules), the floating
layer and its own focus and move commands come later.

The vm-commands sweep floats a window and puts it back, and its health check
counts the floating windows.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:37 -07:00
1 parent 554d77aed9
commit 062fe57fac
20 files changed
+718 -29

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
```text
Toggle floating mode for the focused window
Usage: toggle-float
Options:
-h, --help
Print help
```
+14 -3
View File
@@ -85,7 +85,8 @@ the same thing at every level.
- A **monitor** ([`Monitor`]) is one of the backend's monitors: its bounds, its work area,
its padding, an optional work area offset, and its workspaces. It shows the focused one.
- A **workspace** ([`Workspace`]) has a layout, its padding, and its containers, in order.
- A **workspace** ([`Workspace`]) has a layout, its padding, its containers, in order, and its
floating windows, which are in no container and which the layout does not tile.
- A **container** ([`Container`]) has its windows. A new window gets a container of its
own. A container can be locked, which keeps it at its index while others are inserted,
removed or swapped around it.
@@ -294,6 +295,13 @@ focuses the container at index 0 ([`WindowManager::promote_focus_to_front`]), an
`PromoteWindow` focuses the container in a direction and promotes it. On the grid layout they
change nothing.
`ToggleFloat` takes the window the compositor has focused out of its container into the
workspace's floating windows, and back into a container of its own at the focused index
([`WindowManager::toggle_float`]). A floating window is in the index of managed windows like
any other, so its events find it, and [`Workspace::update`] leaves it where it is. Where a
floated window goes is [`WindowManagementBehaviour::toggle_float_placement`]: by default it
stays where it is.
`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
@@ -362,7 +370,7 @@ module's unit.
- [`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 or
promote the focused container).
promote the focused container, float a window).
- [`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
@@ -563,7 +571,8 @@ A window is shown, and ends up on a tile:
[`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;
[`komorebi/tests/promote.rs`](../../komorebi/tests/promote.rs), promoting.
[`komorebi/tests/promote.rs`](../../komorebi/tests/promote.rs), promoting;
[`komorebi/tests/float.rs`](../../komorebi/tests/float.rs), floating.
- [`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,
@@ -603,6 +612,8 @@ 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::toggle_float`]: ../../komorebi/src/window_manager.rs
[`WindowManagementBehaviour::toggle_float_placement`]: ../../komorebi/src/core/mod.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
+2 -2
View File
@@ -127,8 +127,8 @@ the run.
printed, failing the test if it fails. `state()` is the daemon's state as
`komorebic state` prints it, `managed(workspace)` the number of windows the
daemon has on a workspace of the first monitor, `managed_all()` the number it
has on every workspace of every monitor, and `focused_title(workspace)` the
title of the window it has focused there.
has on every workspace of every monitor (floating windows too), and
`focused_title(workspace)` the title of the window it has focused there.
- `daemon` reads the daemon's view of the desktop from that log, at the debug
level the nodes set: `daemon.events(log)` lists the window events it handled,
in order, `daemon.window_ids(log)` maps a window's title to the daemon's id
+3 -2
View File
@@ -34,8 +34,9 @@ anywhere else. [Running komorebi](usage/running-komorebi.md) explains how to sta
daemon, ask it what it is doing and read its log.
[Focusing windows](usage/focusing-windows.md) explains how to give the focus to another window,
[Moving windows](usage/moving-windows.md) how to move the focused window to another tile,
[Layouts](usage/layouts.md) how to change the arrangement of the tiles, and
[Resizing windows](usage/resizing-windows.md) how to change the size of one.
[Layouts](usage/layouts.md) how to change the arrangement of the tiles,
[Resizing windows](usage/resizing-windows.md) how to change the size of one, and
[Floating windows](usage/floating-windows.md) how to take a window out of the layout.
[Subscribing to notifications](usage/subscribing-to-notifications.md) explains how a program
such as a status bar follows what komorebi does. The [CLI reference](cli/start.md) has a page
for every `komorebic` command, generated from its help.
+15
View File
@@ -0,0 +1,15 @@
# Floating windows
A floating window is one of a workspace's windows that is not in its layout: komorebi gives it no
tile and does not move it, and it stays where it is put by hand.
[`komorebic toggle-float`](../cli/toggle-float.md) takes the window that has the focus out of the
layout, and the other windows of the workspace share the work area. The same command on a
floating window puts it back in the layout, at the place of the focused window.
```sh
komorebic toggle-float
```
A floated window keeps its size and position by default. The floating windows of a workspace are
in the daemon's state as `floating_windows`, next to its containers.