mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-29 11:52:50 +01:00
feat(wm): resize from the CLI
`komorebic resize-edge left|right|up|down increase|decrease` moves one edge of the focused tile, and `resize-axis` both edges along an axis, by the delta that `resize-delta` sets (50 pixels to start with; komorebi-layouts moves an edge by half of it). The neighbors give up the room. A resize is an adjustment of the container's tile that the workspace keeps, one per container, and that the layout applies whenever it tiles. Before each tiling, the workspace clears the parts its layout cannot apply, such as the height of a column. No tile may end up narrower or shorter than a tenth of the work area, or than it already is: a resize that would make one so is granted as far as it can go, not dropped. `retile` drops the adjustments, and the `RetileWithResizeDimensions` message tiles with them. `save-resize` and `load-resize` write them to a file and read them back, and `quick-save-resize` and `quick-load-resize` do the same with one file in the daemon's temporary directory. The vm-commands sweep gains every resize command, and the saving and loading.
This commit is contained in:
1 parent
37b06993d2
commit
95eb4d5039
24 files changed
+1351
-34
No files matched your search
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Load the resize layout dimensions from a file
|
||||
|
||||
Usage: load-resize <PATH>
|
||||
|
||||
Arguments:
|
||||
<PATH>
|
||||
File from which the resize layout dimensions should be loaded
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
Load the last quicksaved resize layout dimensions
|
||||
|
||||
Usage: quick-load-resize
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
Quicksave the current resize layout dimensions
|
||||
|
||||
Usage: quick-save-resize
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
```text
|
||||
Resize the focused window or primary column along the specified axis
|
||||
|
||||
Usage: resize-axis <AXIS> <SIZING>
|
||||
|
||||
Arguments:
|
||||
<AXIS>
|
||||
Possible values:
|
||||
- horizontal: Horizontal axis
|
||||
- vertical: Vertical axis
|
||||
- horizontal-and-vertical: Both horizontal and vertical axes
|
||||
|
||||
<SIZING>
|
||||
Possible values:
|
||||
- increase: Increase
|
||||
- decrease: Decrease
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Set the resize delta (used by resize-edge and resize-axis)
|
||||
|
||||
Usage: resize-delta <PIXELS>
|
||||
|
||||
Arguments:
|
||||
<PIXELS>
|
||||
The delta of pixels by which to increase or decrease window dimensions when resizing
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
```text
|
||||
Resize the focused window in the specified direction
|
||||
|
||||
Usage: resize-edge <EDGE> <SIZING>
|
||||
|
||||
Arguments:
|
||||
<EDGE>
|
||||
[possible values: left, right, up, down]
|
||||
|
||||
<SIZING>
|
||||
Possible values:
|
||||
- increase: Increase
|
||||
- decrease: Decrease
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Save the current resize layout dimensions to a file
|
||||
|
||||
Usage: save-resize <PATH>
|
||||
|
||||
Arguments:
|
||||
<PATH>
|
||||
File to which the resize layout dimensions should be saved
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -27,7 +27,7 @@ its place here.
|
||||
- **Event**: what the compositor reports about a window: it was shown, destroyed, given
|
||||
the focus, minimized or restored ([`WindowManagerEvent`]).
|
||||
- **Message**: what a client sends the daemon on its socket, a [`SocketMessage`]: an order
|
||||
(focus a window, move it, change the layout, retile, stop) or a question (the state, the monitors, one [`StateQuery`]).
|
||||
(focus a window, move it, change the layout, resize it, retile, stop) or a question (the state, the monitors, one [`StateQuery`]).
|
||||
- **Direction**: where an order goes from the focused container: a side of its tile
|
||||
([`OperationDirection`]), or the next or the previous container of the workspace
|
||||
([`CycleDirection`]).
|
||||
@@ -285,6 +285,16 @@ 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`).
|
||||
|
||||
`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
|
||||
the tiles; before every tiling, the workspace clears the parts of each adjustment that its layout
|
||||
cannot apply, such as the top and the bottom of a column. The adjustment is the one
|
||||
`komorebi-layouts` gives for the edge and [`WindowManager::resize_delta`], cut down until no tile
|
||||
would be smaller than a tenth of the work area, or than it is already. The adjustments are kept
|
||||
until a `Retile`, which drops them; `RetileWithResizeDimensions` tiles with them, and `Save`,
|
||||
`Load`, `QuickSave` and `QuickLoad` write them to a file as JSON and read them back.
|
||||
|
||||
`PreselectDirection` reserves the index on one side of the focused container for the next
|
||||
window ([`WindowManager::preselect_container_in_direction`]). The workspace inserts an empty
|
||||
container there ([`Container::preselect`]), which [`Workspace::update`] keeps and the layout
|
||||
@@ -342,7 +352,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).
|
||||
window out, move the focus, move the focused container, change the layout, resize 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
|
||||
@@ -426,6 +437,7 @@ the fake. The window manager is its only caller, through [`backend`]. The contra
|
||||
| A daemon that is told to stop leaves no socket behind | framework path: [`WindowManager::stop`] removes it before it exits | `the_daemon_answers_on_its_socket_and_stops_when_it_is_told_to` | `SIGKILL` |
|
||||
| A container moved onto a locked index is locked in its place, and the lock leaves the container that moved away | framework path: [`Workspace::swap_containers`] swaps through `LockableSequence`, which keeps the lock with the index | `test_swap_respecting_locks_various_cases`, `a_lock_stays_with_its_index_when_a_window_is_moved_onto_it` | `containers_mut()` is the `VecDeque` itself |
|
||||
| A window komorebi puts off the screen stays there | framework path: the bridge asks again for the position of a window KWin pulled back after a `geo` command, for a second, three times at most | `a window KWin pulls back from where it was asked to be is asked for the position again`, `a window that cannot go where it was asked is asked again three times at most`, `vm-scrolling` | a window that cannot go where it was asked is left where KWin put it |
|
||||
| A resize leaves no tile smaller than a tenth of the work area, or than it was | framework path: [`WindowManager::resize_window`] calculates the tiles for the adjustment, and cuts the adjustment down until they all fit | `a_resize_leaves_every_tile_about_a_tenth_of_the_work_area_wide_at_least` | the paddings are taken off afterwards, so a tile can end up a little smaller |
|
||||
| A workspace whose tiling is off moves no window | framework path: [`Workspace::update`] returns before the layout when [`Workspace::tile`] is false | `with_tiling_off_no_window_is_moved_until_it_is_back_on` | none |
|
||||
| Moving the focus moves no window | test | `focus_gives_the_focus_to_the_window_on_that_side_and_moves_nothing`, `vm-core-e2e` ("moving the focus moved no window") | none |
|
||||
| A subscriber that is gone is dropped, not retried | test | `a_subscriber_that_is_gone_is_dropped_and_not_tried_again` | none |
|
||||
@@ -541,7 +553,7 @@ 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.
|
||||
scrolling layout; [`komorebi/tests/resize.rs`](../../komorebi/tests/resize.rs), resizing.
|
||||
- [`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,
|
||||
@@ -579,6 +591,9 @@ A window is shown, and ends up on a tile:
|
||||
[`Workspace::swap_containers`]: ../../komorebi/src/workspace.rs
|
||||
[`Workspace::layout_flip`]: ../../komorebi/src/workspace.rs
|
||||
[`Workspace::layout_options`]: ../../komorebi/src/workspace.rs
|
||||
[`Workspace::resize_dimensions`]: ../../komorebi/src/workspace.rs
|
||||
[`WindowManager::resize_window`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::resize_delta`]: ../../komorebi/src/window_manager.rs
|
||||
[`Workspace::latest_layout`]: ../../komorebi/src/workspace.rs
|
||||
[`LayoutOptions`]: ../../komorebi/src/core/mod.rs
|
||||
[`Workspace::tile`]: ../../komorebi/src/workspace.rs
|
||||
|
||||
+3
-2
@@ -33,8 +33,9 @@ the flake's module, which also starts komorebi with every Plasma session, and fr
|
||||
anywhere else. [Running komorebi](usage/running-komorebi.md) explains how to start and stop the
|
||||
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, and
|
||||
[Layouts](usage/layouts.md) how to change the arrangement of the tiles.
|
||||
[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.
|
||||
[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.
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# Resizing windows
|
||||
|
||||
komorebi resizes the focused window by moving the edges of its tile, and its neighbors give up
|
||||
the room. The size a tile has been given is kept until the workspace is retiled with
|
||||
`komorebic retile`, so it lasts while windows open and close around it.
|
||||
|
||||
## An edge
|
||||
|
||||
[`komorebic resize-edge`](../cli/resize-edge.md) (or `resize`) moves one edge of the focused
|
||||
window: `left`, `right`, `up` or `down`, and `increase` moves it outwards, `decrease` inwards.
|
||||
|
||||
```sh
|
||||
komorebic resize-edge left increase
|
||||
komorebic resize-edge right decrease
|
||||
```
|
||||
|
||||
An edge with no tile on the other side of it, such as the left edge of the first window in the
|
||||
BSP layout, does not move. Neither does an edge the layout keeps where it is: the grid layout
|
||||
has no resizing at all, and in the columns layout a window can only be made wider or narrower.
|
||||
|
||||
## An axis
|
||||
|
||||
[`komorebic resize-axis`](../cli/resize-axis.md) moves both edges of the focused window along an
|
||||
axis: `horizontal` the left and the right edge, `vertical` the top and the bottom edge, and
|
||||
`horizontal-and-vertical` all four.
|
||||
|
||||
```sh
|
||||
komorebic resize-axis horizontal increase
|
||||
```
|
||||
|
||||
## How far
|
||||
|
||||
[`komorebic resize-delta`](../cli/resize-delta.md) sets how far a resize goes, in pixels: an
|
||||
edge moves by half of it. The delta starts at 50, so an edge moves by 25 pixels.
|
||||
|
||||
```sh
|
||||
komorebic resize-delta 100
|
||||
```
|
||||
|
||||
A resize never makes a tile narrower or shorter than a tenth of the monitor's work area, unless
|
||||
the tile is smaller than that already: a resize that would is carried out as far as it can go.
|
||||
|
||||
## Back to the layout
|
||||
|
||||
[`komorebic retile`](../cli/retile.md) tiles every monitor again in its layout, without the
|
||||
sizes the tiles were given. To tile again and keep them, send the `RetileWithResizeDimensions`
|
||||
message, which has no subcommand of its own.
|
||||
|
||||
## Saving and loading the sizes
|
||||
|
||||
The sizes the tiles of the focused workspace were given can be saved to a file and loaded back,
|
||||
on the same workspace or another one with as many windows:
|
||||
|
||||
```sh
|
||||
komorebic save-resize ~/sizes.json
|
||||
komorebic load-resize ~/sizes.json
|
||||
```
|
||||
|
||||
[`komorebic quick-save-resize`](../cli/quick-save-resize.md) and
|
||||
[`komorebic quick-load-resize`](../cli/quick-load-resize.md) do the same with one file the daemon
|
||||
keeps in its temporary directory, `komorebi.quicksave.json` in `$TMPDIR` (or `/tmp`). A path
|
||||
given to `save-resize` and `load-resize` can name environment variables, which `komorebic`
|
||||
expands.
|
||||
Reference in new issue
Block a user