mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-12-01 04:34:11 +01:00
feat(wm): padding and work-area offsets
Every workspace was tiled with the default padding of 5 pixels around and between its tiles, and the work area offsets could not be set. The padding commands set a workspace's own workspace padding and container padding, by the indices of its monitor and itself or for the focused workspace, and the adjust commands make the focused workspace's larger or smaller. `global-work-area-offset`, `monitor-work-area-offset` and `workspace-work-area-offset` keep a part of the work area free of tiles, and a workspace's offset now wins over its monitor's, which wins over the global one. A monitor's window-based offset applies while the workspace in front has no more windows than the monitor's limit, and `toggle-window-based-work-area-offset` turns it off and on for the focused workspace. The vm-commands sweep sets and resets every offset and padding.
This commit is contained in:
1 parent
56294e1cd3
commit
c95be9391e
24 files changed
+1083
-15
No files matched your search
@@ -0,0 +1,19 @@
|
||||
```text
|
||||
Adjust container padding on the focused workspace
|
||||
|
||||
Usage: adjust-container-padding <SIZING> <ADJUSTMENT>
|
||||
|
||||
Arguments:
|
||||
<SIZING>
|
||||
Possible values:
|
||||
- increase: Increase
|
||||
- decrease: Decrease
|
||||
|
||||
<ADJUSTMENT>
|
||||
Pixels to adjust by as an integer
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
```text
|
||||
Adjust workspace padding on the focused workspace
|
||||
|
||||
Usage: adjust-workspace-padding <SIZING> <ADJUSTMENT>
|
||||
|
||||
Arguments:
|
||||
<SIZING>
|
||||
Possible values:
|
||||
- increase: Increase
|
||||
- decrease: Decrease
|
||||
|
||||
<ADJUSTMENT>
|
||||
Pixels to adjust by as an integer
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
```
|
||||
@@ -0,0 +1,20 @@
|
||||
```text
|
||||
Set the container padding for the specified workspace
|
||||
|
||||
Usage: container-padding <MONITOR> <WORKSPACE> <SIZE>
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
<WORKSPACE>
|
||||
Workspace index on the specified monitor (zero-indexed)
|
||||
|
||||
<SIZE>
|
||||
Pixels to pad with as an integer
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Set container padding on the focused workspace
|
||||
|
||||
Usage: focused-workspace-container-padding <SIZE>
|
||||
|
||||
Arguments:
|
||||
<SIZE>
|
||||
Pixels size to set as an integer
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
```text
|
||||
Set workspace padding on the focused workspace
|
||||
|
||||
Usage: focused-workspace-padding <SIZE>
|
||||
|
||||
Arguments:
|
||||
<SIZE>
|
||||
Pixels size to set as an integer
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
```text
|
||||
Set offsets to exclude parts of the work area from tiling
|
||||
|
||||
Usage: global-work-area-offset <LEFT> <TOP> <RIGHT> <BOTTOM>
|
||||
|
||||
Arguments:
|
||||
<LEFT>
|
||||
Size of the left work area offset (set right to left * 2 to maintain right padding)
|
||||
|
||||
<TOP>
|
||||
Size of the top work area offset (set bottom to the same value to maintain bottom padding)
|
||||
|
||||
<RIGHT>
|
||||
Size of the right work area offset
|
||||
|
||||
<BOTTOM>
|
||||
Size of the bottom work area offset
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
```text
|
||||
Set offsets for a monitor to exclude parts of the work area from tiling
|
||||
|
||||
Usage: monitor-work-area-offset <MONITOR> <LEFT> <TOP> <RIGHT> <BOTTOM>
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
<LEFT>
|
||||
Size of the left work area offset (set right to left * 2 to maintain right padding)
|
||||
|
||||
<TOP>
|
||||
Size of the top work area offset (set bottom to the same value to maintain bottom padding)
|
||||
|
||||
<RIGHT>
|
||||
Size of the right work area offset
|
||||
|
||||
<BOTTOM>
|
||||
Size of the bottom work area offset
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
```text
|
||||
Toggle application of the window-based work area offset for the focused workspace
|
||||
|
||||
Usage: toggle-window-based-work-area-offset
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,20 @@
|
||||
```text
|
||||
Set the workspace padding for the specified workspace
|
||||
|
||||
Usage: workspace-padding <MONITOR> <WORKSPACE> <SIZE>
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
<WORKSPACE>
|
||||
Workspace index on the specified monitor (zero-indexed)
|
||||
|
||||
<SIZE>
|
||||
Pixels to pad with as an integer
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,29 @@
|
||||
```text
|
||||
Set offsets for a workspace to exclude parts of the work area from tiling
|
||||
|
||||
Usage: workspace-work-area-offset <MONITOR> <WORKSPACE> <LEFT> <TOP> <RIGHT> <BOTTOM>
|
||||
|
||||
Arguments:
|
||||
<MONITOR>
|
||||
Monitor index (zero-indexed)
|
||||
|
||||
<WORKSPACE>
|
||||
Workspace index (zero-indexed)
|
||||
|
||||
<LEFT>
|
||||
Size of the left work area offset (set right to left * 2 to maintain right padding)
|
||||
|
||||
<TOP>
|
||||
Size of the top work area offset (set bottom to the same value to maintain bottom padding)
|
||||
|
||||
<RIGHT>
|
||||
Size of the right work area offset
|
||||
|
||||
<BOTTOM>
|
||||
Size of the bottom work area offset
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -85,8 +85,10 @@ element focused, so that "the focused workspace" or "the focused container" mean
|
||||
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, its containers, in order, and its
|
||||
its padding, an optional work area offset, an optional window-based offset with the number of
|
||||
windows up to which it applies, and its workspaces. It shows the focused one.
|
||||
- A **workspace** ([`Workspace`]) has a layout, its padding, an optional work area offset of its
|
||||
own, whether it takes the monitor's window-based offset, 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,
|
||||
@@ -95,9 +97,11 @@ the same thing at every level.
|
||||
Everything else about the window, and every change to it, goes through the backend.
|
||||
|
||||
Tiling a workspace ([`Workspace::update`]) is a function of this tree and a work area. The
|
||||
monitor gives its focused workspace the work area, the padding to fall back to and the
|
||||
offset ([`WorkspaceGlobals`]). The workspace takes the offset and its padding off the work
|
||||
area, the layout gives one tile per container, in order, each shrunk by the container
|
||||
monitor gives its focused workspace the work area, the padding to fall back to, the offset
|
||||
(its own, or else the window manager's) and its window-based offset ([`WorkspaceGlobals`]).
|
||||
The workspace takes the offset (its own, or else the monitor's) off the work area, then the
|
||||
window-based offset while it has no more containers than the monitor's limit, then its
|
||||
padding; the layout gives one tile per container, in order, each shrunk by the container
|
||||
padding, and every window of a container is asked to move onto its tile with `set_rect`. A
|
||||
tile is clamped to the work area, so it cannot reach onto a neighboring monitor.
|
||||
|
||||
@@ -328,6 +332,15 @@ window manager. `UnmanagedWindowOperationBehaviour` sets
|
||||
focused is in no container of the focused workspace
|
||||
([`WindowManager::handle_unmanaged_window_behaviour`]).
|
||||
|
||||
`WorkspacePadding`, `ContainerPadding` and their `FocusedWorkspace` forms set a workspace's own
|
||||
padding, and `AdjustWorkspacePadding` and `AdjustContainerPadding` change the focused
|
||||
workspace's by a number of pixels, which needs a padding of its own to change
|
||||
([`WindowManager::adjust_workspace_padding`]). `WorkAreaOffset`, `MonitorWorkAreaOffset` and
|
||||
`WorkspaceWorkAreaOffset` set the offset of the window manager, of a monitor or of a workspace,
|
||||
and `ToggleWindowBasedWorkAreaOffset` sets whether the focused workspace takes its monitor's
|
||||
window-based offset ([`Workspace::apply_window_based_work_area_offset`]). Each tiles the
|
||||
workspace in front again, or every monitor.
|
||||
|
||||
`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
|
||||
@@ -396,8 +409,8 @@ 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, float a window, lock a container, manage and unmanage a
|
||||
window).
|
||||
promote the focused container, float a window, lock a container, set the padding of a
|
||||
workspace, manage and unmanage 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
|
||||
@@ -484,6 +497,7 @@ the fake. The window manager is its only caller, through [`backend`]. The contra
|
||||
| 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 |
|
||||
| The offset of a workspace wins over its monitor's, which wins over the window manager's | framework path: [`Monitor::update_workspace_globals`] gives the workspace the monitor's offset or else the window manager's, and [`Workspace::update`] takes its own before that | `the_workspaces_offset_wins_over_the_monitors_which_wins_over_the_global_one` | none |
|
||||
| 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 |
|
||||
@@ -604,7 +618,9 @@ A window is shown, and ends up on a tile:
|
||||
[`komorebi/tests/float.rs`](../../komorebi/tests/float.rs), floating;
|
||||
[`komorebi/tests/lock.rs`](../../komorebi/tests/lock.rs), locking;
|
||||
[`komorebi/tests/manage.rs`](../../komorebi/tests/manage.rs), minimizing, closing,
|
||||
unmanaging and managing the focused window, and pausing.
|
||||
unmanaging and managing the focused window, and pausing;
|
||||
[`komorebi/tests/padding.rs`](../../komorebi/tests/padding.rs), the paddings and the work area
|
||||
offsets.
|
||||
- [`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,
|
||||
@@ -646,6 +662,9 @@ A window is shown, and ends up on a tile:
|
||||
[`WindowManager::resize_window`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::toggle_float`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::toggle_lock`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::adjust_workspace_padding`]: ../../komorebi/src/window_manager.rs
|
||||
[`Workspace::apply_window_based_work_area_offset`]: ../../komorebi/src/workspace.rs
|
||||
[`Monitor::update_workspace_globals`]: ../../komorebi/src/monitor.rs
|
||||
[`WindowManager::manage_focused_window`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::unmanage_focused_window`]: ../../komorebi/src/window_manager.rs
|
||||
[`WindowManager::is_paused`]: ../../komorebi/src/window_manager.rs
|
||||
|
||||
+4
-2
@@ -36,9 +36,11 @@ daemon, ask it what it is doing and read its log.
|
||||
[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,
|
||||
[Resizing windows](usage/resizing-windows.md) how to change the size of one,
|
||||
[Floating windows](usage/floating-windows.md) how to take a window out of the layout, and
|
||||
[Floating windows](usage/floating-windows.md) how to take a window out of the layout,
|
||||
[Managing windows](usage/managing-windows.md) how to minimize, close and unmanage the focused
|
||||
window and pause the daemon.
|
||||
window and pause the daemon, and
|
||||
[Padding and work area offsets](usage/padding-and-offsets.md) how to put gaps around the tiles
|
||||
and keep parts of a monitor free of them.
|
||||
[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,76 @@
|
||||
# Padding and work area offsets
|
||||
|
||||
komorebi tiles the windows of a workspace in the work area of its monitor, which is the part of
|
||||
the monitor that KWin reports free of Plasma's panels. Padding puts gaps around the tiles, and an
|
||||
offset keeps a part of the work area free of tiles.
|
||||
|
||||
## Padding
|
||||
|
||||
A workspace has two paddings, in pixels:
|
||||
|
||||
- the **workspace padding**, between the edges of the work area and the tiles;
|
||||
- the **container padding**, around each tile, so that two tiles side by side are twice that far
|
||||
apart.
|
||||
|
||||
A workspace that has no padding of its own takes 5 pixels for each.
|
||||
|
||||
[`komorebic focused-workspace-padding`](../cli/focused-workspace-padding.md) and
|
||||
[`komorebic focused-workspace-container-padding`](../cli/focused-workspace-container-padding.md)
|
||||
set the paddings of the focused workspace, and
|
||||
[`komorebic workspace-padding`](../cli/workspace-padding.md) and
|
||||
[`komorebic container-padding`](../cli/container-padding.md) those of a workspace given by the
|
||||
index of its monitor and its own, counted from 0.
|
||||
|
||||
```sh
|
||||
komorebic focused-workspace-padding 20
|
||||
komorebic focused-workspace-container-padding 10
|
||||
komorebic workspace-padding 0 1 0
|
||||
komorebic container-padding 0 1 0
|
||||
```
|
||||
|
||||
[`komorebic adjust-workspace-padding`](../cli/adjust-workspace-padding.md) and
|
||||
[`komorebic adjust-container-padding`](../cli/adjust-container-padding.md) make a padding of the
|
||||
focused workspace larger or smaller by a number of pixels. They change a padding the workspace
|
||||
has of its own, set by one of the commands above: on a workspace that has none, the daemon logs
|
||||
"there is no workspace padding" or "there is no container padding". A padding is not made
|
||||
smaller than 0.
|
||||
|
||||
```sh
|
||||
komorebic adjust-workspace-padding increase 5
|
||||
komorebic adjust-container-padding decrease 5
|
||||
```
|
||||
|
||||
## Work area offsets
|
||||
|
||||
An offset is four numbers. The first two move the top left corner of the work area right and
|
||||
down; the last two make the work area narrower and shorter. So `0 40 0 40` keeps a strip of 40
|
||||
pixels at the top free, `0 0 0 40` a strip at the bottom, and `40 0 40 0` a strip on the left.
|
||||
|
||||
[`komorebic global-work-area-offset`](../cli/global-work-area-offset.md) sets the offset of every
|
||||
monitor, [`komorebic monitor-work-area-offset`](../cli/monitor-work-area-offset.md) the offset of
|
||||
one monitor, which it takes instead of the global one, and
|
||||
[`komorebic workspace-work-area-offset`](../cli/workspace-work-area-offset.md) the offset of one
|
||||
workspace, which it takes instead of both. Each tiles every monitor again, as
|
||||
[`komorebic retile`](../cli/retile.md) does.
|
||||
|
||||
```sh
|
||||
komorebic global-work-area-offset 0 40 0 40
|
||||
komorebic monitor-work-area-offset 1 0 0 0 40
|
||||
komorebic workspace-work-area-offset 0 2 40 0 40 0
|
||||
```
|
||||
|
||||
A monitor can also have a window-based offset, which applies on top of the other one while the
|
||||
workspace in front has no more windows than the monitor's limit, 1 unless it is given another.
|
||||
With a window-based offset, a window that is alone on a wide monitor does not have to take its
|
||||
whole width. No command sets a monitor's window-based offset: it is part of the configuration of
|
||||
a monitor.
|
||||
[`komorebic toggle-window-based-work-area-offset`](../cli/toggle-window-based-work-area-offset.md)
|
||||
turns it off for the focused workspace, and on again.
|
||||
|
||||
```sh
|
||||
komorebic toggle-window-based-work-area-offset
|
||||
```
|
||||
|
||||
The daemon's state has the offsets as `work_area_offset` (of the window manager, of each monitor
|
||||
and of each workspace), and a monitor's window-based offset and limit as
|
||||
`window_based_work_area_offset` and `window_based_work_area_offset_limit`.
|
||||
Reference in new issue
Block a user